Palindrome Number

Easy

Company Tags

You are given an integer x, return true if x is a palindrome, and false otherwise.

Note: An integer is a palindrome when it reads the same forward and backward.

For example, 111 and 121 are palindromes while 123 is not.

Example 1:

Input: x = 1

Output: true

Example 2:

Input: x = -1

Output: false

Constraints:

  • -(2^31) <= x <= ((2^31) - 1)

Follow up: Could you solve it without converting the integer to a string?



Company Tags

Please upgrade to NeetCode Pro to view company tags.

x =