I came across a question "Reverse the given Integer" But in constraints, it's given we have to check if the results fit in a 32 bit signed integer or not. Can someone help with how to check this?
Asked
Active
Viewed 60 times
0
-
Store the result into a 64 bit integer and compare it with INT_MAX from limits.h – Jerry Jeremiah May 18 '21 at 21:11
-
3Does this answer your question? [How do I detect unsigned integer multiply overflow?](https://stackoverflow.com/questions/199333/how-do-i-detect-unsigned-integer-multiply-overflow) (it has some solutions for signed integers although the question is stated as it is) – Ted Lyngmo May 18 '21 at 21:32