-2147483648 is out of integer range.Yet its given as in a test case.Fix it please.
-2147483648 is INT_MIN
2147483647 is INT_MAX
When I just changed the argument type from int to long long int ,it worked.Why is it so?
Probably it overflows somewhere. For example, n = -2147483648, then we call n = -n. Using long long may be a great approach.
n = -2147483648
n = -n
Yeah exactly.I called -n.Thanks.Now I feel the test case should strongly be kept as this is a tricky corner case.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.