← All problemsSign in

Laddu and his Girlfriend

Problem description. Mochu, Laddu's girlfriend :P, yes, Laddu does have a girlfriend, has an array A of N integers, but she is very unhappy with it. She only likes an array if all its neighbouring elements are different (e.g. she likes the array [2,4,2,5,3,2,4], but not [1,2,3,3,4]). She now has asked Laddu to please her but with some restrictions. Laddu can reverse any contiguous subarray of h

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