What should we do with the leading zeros?

  • 3

    For example, if the input is "001", what should be returned? or what should be returned with "123000004"?

  • 15

    01 is a invalid decode. so is 001, 0001...

    So if there is 0 in string, it can only be the zero of 10 and 20.

    As for 001 and 123000004, the output of them are 0, because no valid decode ways for them.

Log in to reply

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