← All problemsSign in

Sorting Twist

You all must have used insertion sort somewhere in your life. It is a classical sorting technique. One variant of insertion sort works as follows when sorting an array a[1...N] in non-descending order: for i = 2 to N j = i while j > 1 and a[j] Input The first line contains the number of test cases T. T test cases follow. The first line for each case contains N, the number of elements to be sor

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