What is the smallest in lexicographical order?


  • 6
    C

    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!


  • 0
    P

  • 0
    L

    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 < ...


  • 3
    V

    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.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.