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, return 0. This is a direct digit-by-digit extraction problem with overflow handling.
x = signed integer
reversed integer or 0 if overflow occurs
Example 1:
Input:
x = 123
Output:
321
Explanation:
123 reversed becomes 321.
Example 2:
Input:
x = -120
Output:
-21
Explanation:
Leading zeroes are dropped and the sign is preserved.