Why "01' result is 0 ?


  • 1
    A

    Input: "01"
    Output: 1
    Expected: 0

    I think

    "01" -> '0'=>not, '1' => A,

    it has one character right??

    why expected result is 'Zero' ??

    please tell me questions condition...
    or
    what means "01" ?

    it's too confused


  • 3
    H

    Everything digit has to be used to decode to some character. In the case of "01" there is no way to decode the initial '0'.

    This is different from cases like, '10', where '1' and '0' together can be decoded to 'J'.


  • 0
    A

    thank you.

    '01' => no
    '0' => no, '1'=> character
    {no,A},{no} => has 'no' valid string.

    "10"
    '1'=> character, '0'=>no
    '10' => character
    {A,no},{J} => has 'one' valid string.

    thank you for answer.


Log in to reply
 

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