Why do we need tokens[i].equals("") continue?

  • 0

    In the above code, why exactly do we need the following statements:


    I'm assuming it's something to do with the way split words because in my code, I didn't have those statements and I wasn't getting the correct answer - the extra spaces weren't getting removed.

    So I think the issue is that I'm not completely clear on how s.split(" ") works.

    Thank you for your help!

  • 0

    Please check this link for the usage of split( )


Log in to reply

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