Search
⌘K

Leetcode 3216. Lexicographically Smallest String After a Swap

Given a string of digits, you may perform at most one swap of adjacent digits that share the same parity (both even or both odd); return the lexicographically smallest string obtainable by choosing the best such adjacent-parity swap (or none).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.