Tomaz Kastrun shuffles things around:
The problem is described as:
Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-2^31, 2^31 – 1], then return 0.
For example:
x = 120; reversed_x = 21
x = -2310; reversed_x = -132
Read on to see how you can implement this in R.