"abc-2" = ? 8. String to Integer (atoi)


  • 0
    C

    I think "abc-2" should be -2. however expected = 0.
    also why "+-4" = 0 ?? just don't make sense to me...


  • 0
    W

    When input testcase is "+2abc2", expected answer is 2, so it seems that this String to Integer question aims to obtain an answer of compliant integer from the leftmost side of the stirng


  • 0
    Y

    If the given string is illegal, your answer should be 0.


Log in to reply
 

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