My java solution


  • 0
    A

    public class Solution {
    public boolean isPalindrome(int x) {

        if(x<0)
            return false;
        int i = x;
        
        int j=0;
        while(i!=0)
        {
            j = j * 10 + i % 10;
            i = i / 10;
        }
        if(j == x)
        return true;
        else
        return false;
    }
    

    }


Log in to reply
 

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