Check if a Number is a Palindrome

Published by Helen Yu in

Write a function that returns true if a number is a palindrome.

Examples

is_palindrome(838) ➞ true

is_palindrome(4433) ➞ false

is_palindrome(443344) ➞ true

Notes

  • A palindrome is a number that remains the same when reversed.
  • Bonus: Try solving this without turning the number into a string.
Watch a quick demo on how Edabit works.