Inversions Retrieval
There is a hidden vector $F$, which initially has $N$ values $F_0, F_1, \ldots , F_{N-1}$, which are a permutation of $\{0,1,\ldots,N-1\}$. You want to find the number of inversions in $F$, that is, the number of pairs $(i,j)$ with $0 \le i \lt j \le N-1$ and $F_i \gt F_j$. By calling some functions defined later, you can append some values to the end of $F$. Say, currently $F = [F_0, F_1, \dot
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