← All problemsSign in

Crazy String

Given a crazy string $s$. $Axios$ wants to sort the crazy string in lexicographical order as quick as possible. Everyday $Axios$ chooses any two $adjacent$ indices of the crazy string and swaps them, and then goes to sleep. $Equinox$ likes annoying $Axios$, so he comes and swaps two $adjacent$ characters of the crazy string after $Axios$ goes to sleep. But sadly, $Equinox$ does not know w

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