(Python) Do not understand test demands


  • 0
    B

    My program incorrect handles that test:

    Input: "+-2"

    Output: -2

    Expected: 0

    But for example input in Python 3.4.2 Shell:

    >>> ---7
    -7
    >>> +-2
    -2
    

    Where is base for test logic?


  • 0
    M

    From my understanding, it only allows 1 operator. If another operator is encountered, it should short-circuit and exit.


Log in to reply
 

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