I don't quite understand this sentence. "You must make sure your result is the smallest in lexicographical order among all possible results.", Can anyone give more examples about this?
Thanks!
The formal definition is given at here. For simplicity, you can understand the lexicographical order as the order used in a dictionary.
Some examples.
a < aa < aaa < ab < abb < abc < b < bcd < be < ...
What the question means is that you can't change their relative position, and under such condition, you have to make sure your result is the smallest in lexicographical order. If you don't need to keep their relative position, the .sort() function can solve it. But unfortunately, it doesn't work.