Submission Result: Wrong Answer


  • 0
    N

    HI guys,

    May you help look into this? I seriously suspect that the expected output is not correct for this case. Thanks.

    ----------------------------
    Submission Result: Wrong Answer
    
    Input:	"+-2"
    Output:	-2
    Expected:	0

  • 0
    S

    +-2 is invalid. So, the results is 0.


  • 0
    N

    invalid? how could we do know that case? why the output "-2" is not correct?


  • 0
    L

    The requirements specify that it only takes in one optional plus or minus sign:

    “Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical digits as possible, and interprets them as a numerical value.”


Log in to reply
 

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