0

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?

Ted Lyngmo
  • 93,841
  • 5
  • 60
  • 108
RikeshKr
  • 1
  • 1
  • 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
  • 3
    Does 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

0 Answers0