Median Subsets (Prefix)
The median of an array $B$ of length $K$ is obtained as follows: 1. Sort $B$ in non-decreasing order, i.e. $B_1 \le B_2 \le \ldots \le B_K$. 2. After sorting, the median is the element at index $\left\lceil \frac{K}{2} \right\rceil$ of $B$. In other words, after sorting, if $K$ is odd, the median is the middle element, and if $K$ is even the median is the left of the two middle elements. For an
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