Simple Java solution


  • 0
    E
    public class Solution {
        public boolean isPalindrome(int x) {
            if(x < 0) return false;
            int mirr = 0, num = x;
            do {
                mirr  = mirr * 10 + num % 10;
            } while((num /= 10) > 0);
            return (mirr == x);
        }
    }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.