Reverse Digits of a 32-bit Integer

Asked at Warner Music Group · Coding Questions · Difficulty: Medium

Given a 32-bit signed integer `x`, return the integer whose decimal digits are the digits of `x` in reverse order. The sign is kept. If the reversed value does not fit in a 32-bit signed integer, return `0`.

Loading the problem…