One linear java solution


  • 0
    M
    return (x<0) ? false:String.valueOf(x).equals(new StringBuilder(Integer.toString(x)).reverse().toString());

Log in to reply
 

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