← All problemsSign in

Bob and Candies

Bob is at a candy store. There are $N$ candies in the store. The store of ith candy is $A_i$. The store has some strange rule regarding buying candies. Given integers $L$ and $R$. You can buy a pair of candies if they are atleast L and atmost R distance apart from each other i.e. if you buy ith candy you can buy another candy only in range $[i-R,i-L]$ and $[i+L,i+R]$ of course if it lies in the ra

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