There will also be negative number: deal with the “-” first
The String only contains “-” and numbers, because this is an integer.
There are 4 cases:
-
- and +: subtract
-
- and +: sum
-
- and -: sum
-
- and -: subtract
subtract: larger - smaller
sum: no matter
time: O(n)
space: O(1)