← All problemsSign in

Hilary And Array

Hilary Clinton has an array of n integers from 1 to n. Now she starts swapping the array elements. She can swap any number by a number that is immediate left to that number. For a particular number this operation can be performed up to a maximum of two times. For e.g. if n=5, the array elements are 1,2,3,4,5 . 5 can be swapped by 4 and then 5 can be swapped again by 3. Then the array would look li

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