Sorting Array
Given an array $A$ of length $N$. You are allowed to perform the following operation on the array $A$ **atmost** $20$ times: - Select a **non-empty** [subsequence](https://en.wikipedia.org/wiki/Subsequence) $S$ of the array $[1,2,3,\ldots,N]$ and an integer $X$ $(0 \leq X \leq 10^6)$; - Change $A_i$ to $A_i+X$ for all $i \in S$. You have to sort the array $A$ in **strictly increasing** order
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