4 lines Java code : use string to help , so easy!


  • 0
    I

    class Solution {
    public boolean isPalindrome(int x) {
    if(Integer.toString(x).compareTo(new StringBuffer(Integer.toString(x)).reverse().toString())==0)
    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.