Skip to main content
LeetCode 9, Easy. Topics: Math. View on LeetCode. Generate this problem as a practice environment: tested reference solution, 16 parametrized pytest cases, and a playground notebook:

Problem

Given an integer x, return true if x is a palindrome, and false otherwise.

Examples

Constraints

  • -2^31 <= x <= 2^31 - 1
Follow up: Could you solve it without converting the integer to a string?

Solution

Reference implementation from solution.py on GitHub, full suite in test_solution.py:

Complexity

Tags

Grind, NeetCode All.
Last modified on August 25, 2026