Min-Max Queries
For an array $B$ of length $M$, define a recursive function $\mathrm{min\_max}(B)$ as follows: - If $M = 1$, then $\mathrm{min\_max}(B) = B_1$. - If $M$ is even, then $\mathrm{min\_max}(B) = \mathrm{min\_max}(\mathrm{adjacent\_maxima}(B))$. - If $M$ is odd, then $\mathrm{min\_max}(B) = \mathrm{min\_max}(\mathrm{adjacent\_minima}(B))$. Here: - $\mathrm{adjacent\_maxima}(B)$ is the array $D$ of len
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