~/boss / soldier-line

Merge sort

The Army Sort

Split the army until every soldier stands alone. Then merge it back into one perfect line.

Loading the fight…

How to beat it

One soldier is already sorted. To merge two sorted lines, compare their front soldiers: the smaller one steps into the new line. When one line runs out, the rest walk on. Pairs become fours, fours become eights, and every level is one pass.

Now the real boss

Interviews ask for the code. Watch it run, then write it yourself, tested in Python, C++ or Java.

On your phone? Writing code is easier on a laptop: open bossfight.dev/problems/sort-numbers-without-the-built-in-sort there. Sign in with your email to keep your progress on every device.

More bosses

esc