Lucky Pair
CodeChefOpen on judge ↗
Aryan goes to buy candles from the market where he bought $N$ candles. A pair of candles is lucky if the absolute difference of their height is strictly greater than $l$ and less than or equal to $r$. You are given $N$ candles and $Hi$ represent the height of each candle. Now, you have to tell the total number of lucky pairs of candles. ### Input The first line contains the number of testcases $
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