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³¹, 2³¹ - 1], return 0.
Input: x = 123
Output: 321
Input: x = -123
Output: -321
Input: x = 120
Output: 21
Runner reads a single integer from stdin (e.g. 123) and expects a single integer printed to stdout (e.g. 321).
No submissions yet.
Share approaches: string-reverse, math-based reversal, overflow checks.