Ansh and Parth
CodeChefOpen on judge ↗
Ansh and Parth love playing games with arrays. But unfortunately, Parth never succeeds to beat Ansh. But this time Parth came up with a new game which he expects Ansh to lose. Ansh has to find the number of ways to construct an array such that every consecutive element in the array has a different value. Also every element in the array should be in the range $[L, R]$ (both inclusive). Apart from
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