Rapid Re-Orderings
You are given an array $B$ of length $2N$ . You have an unknown array $A$ which is sorted and contains *distinct* elements. You need to find out the array $A$. $B$ contains all the medians of each prefix and suffix of the array $A$. A median is the middle element in a sorted array . $[1,2,3,4]$ has median $2$ and $[1,3,4]$ has $3$ as median. Determine whether $B$ is a valid array of some array $
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