Partition Score
Given an array $A$ of size $N$, we must partition the array into $2$ **disjoint** subsets $S_1$ and $S_2$ such that every element of $A$ belongs to either $S_1$ or $S_2$. Further, we are given a parameter $K$ and must ensure $|S_1| \ge K$ and $|S_2| \ge K$, i.e. both $S_1$ and $S_2$ have size at least $K$. We define $score = \min(S_1) + \max(S_1) + \min(S_2) + \max(S_2)$, where $\min(S_1)$ is th
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start