← All problemsSign in

Almost Friends

There are $N$ kids labeled $1$, $2$, ..., $N$ sitting in a circle such that $1$ and $N$ are adjacent to each other. $i^{th}$ kid has $A_i$ chocolates with him. Also, kids sitting adjacent have **almost** the same number of chocolates, so that they don't fight with each other. 2 kids, having $A_x$ and $A_y$ chocolates each, are said to have **almost** same number of chocolates if $| A_x - A_y | \l

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start