Commander
CodeChefOpen on judge ↗
There is a war going on in CodeLand and all the coders have formed a single straight line to move secretly through trenches. Since the beginning, all the coders arranged themselves in non-decreasing order of their heights. After they’ve lined up correctly, they are assigned id as their position in line(starting from 1). The commander is chosen by the following conditions: - Commander’s height is s
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