← All problemsSign in

Minimum or Maximum

CodeChefRating 1233Open on judge ↗

From a hidden array $A$ of length $N$, Stack constructs an array $B$ of length $N$ such that: - For all $i$ $(1 \leq i \leq N)$, $B_i=\max(A_1,A_2,\ldots,A_i)$ **or** $B_i=\min(A_1,A_2,\ldots,A_i)$. For the given array $B$ of length $N$, Stack wants you to check whether a possible array $A$ exists or not. ### Input - The first line of input contains a single integer $T$, denoting the number of t

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start