Christmas Candy
There are $N$ friends numbered $1$ to $N$, seated in a straight line where the $i^{th}$ seat is taken by friend numbered $A_i$. This Christmas, the friends have decided to distribute candies amongst each other. For each $1\le i \lt N$, the friend at the $i^{th}$ seat will gift **one** candy to the friend at the $j^{th}$ seat if: - $j \gt i$ ; - $A_j \lt A_i$ Find the number of people who re
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