less than 1 minute read

Given a non-negative integer num, return whether it is a palindrome.

Bonus: Can you solve it without using strings?

Constraints

  • num < 2 ** 31

https://binarysearch.com/problems/Palindromic-Integer

Examples

Example 1

Input

  • num = 20200202

Output

  • answer = True

Example 2

Input

  • num = 43

Output

  • answer = False

Example 3

Input

  • num = 121

Output

  • answer = True

Solution

Leave a comment