Reverse integer

Reverse digits of an integer.

Example1:

x = 123,

return 321
Example2:

x = -123,

return -321

Return 0 if the result overflows and does not fit in a 32 bit signed integer

Interview Code Editor
Hints
  • Solution Approach
  • Complete Solution
7961 successful submissions.
Asked In:
  • HCL
  • Bloomberg
Click here to jump start your coding interview preparation