Terminal States
You are given an array $A$ of size $N$, which is initially a permutation of the integers in the range $[1, N]$. You can do the following operation multiple times on $A$: - Choose $i, j$ such that $1 \le i < j \le |A|$ and $A_i > A_j$, then choose to delete either $A_i$ or $A_j$. We say an array $A$ is **terminal** if it is not possible to perform any operations on $A$. We say an array $B$ is **
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