Erase All But One
You are given a permutation $P$ of length $N$. You can perform the following operation on $P$: - Choose any $i$ and $j$ such that $i \lt j$ and $P_i \lt P_j$, and remove exactly one of them from the array. After removing, the remaining parts of the array are concatenated. Find out if it is possible to apply the given operation any number of times such that only one element remains in the 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