arrow_back Back to Challenges

#7 Reverse Integer

Medium Acceptance 0%
description

Problem Description

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`. Assume the environment does not allow you to store 64-bit integers.

checklist Constraints

-2^31 <= x <= 2^31 - 1

science Examples

Case #1

In: x = 123
Out: 321

Case #2

In: x = -123
Out: -321

Case #3

In: x = 120
Out: 21

Mastery Tags

Math

Hiring Companies

Apple Bloomberg Google
code

Integrated IDE

code_blocks
Coding
psychology
Aptitude