Given a string representation of an integer (with an optional leading + or - sign and no spaces), determine if it overflows a 32-bit signed integer range.
Return:
1 if the number is greater than 2^31 - 1 (positive overflow)-1 if the number is less than -2^31 (negative overflow)0 if the number is within the 32-bit signed integer range [-2^31, 2^31 - 1]You may assume the input is a valid integer string (digits only, with an optional leading sign). The input will not be empty.
s = "2147483647"0s = "2147483648"1s = "-2147483649"-11 <= s.length <= 20s consists of digits and optionally a leading '+' or '-' sign.s represents a valid integer (no spaces, no letters).Run your code to see results
Use Cmd+Enter to run