3216. Lexicographically Smallest String After a Swap
Given a string
scontaining only digits, return thelexicographically smallest string
that can be obtained after swapping adjacent digits in
swith the same parity at most once.Digits have the same parity if both are odd or both are even. For example, 5 and 9, as well as 2 and 4, have the same parity, while 6 and 9 do not.
1 | class Solution { |