Reverse Words in a String: why reverse of a space is empty string?


  • 0
    E

    Submission Result: Wrong Answer
    Input: " "
    Output: " "
    Expected: ""

    seems to me the reverse of a space is still a space, not an empty string. am I missing something?

    BTW, can we sort the OJ topic in alphabetical order? takes forever to find the right one


  • 1
    J

    Reread the problem. Remove any leading and following empty spaces. Also any duplicate spaces.


Log in to reply
 

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