C++ code


  • 0
    P

    bool isPalindrome(int x) {
    string s= to_string(x);
    int i=0,j=s.length()-1;
    while( i<=j){
    if(s[i++]!=s[j--]){
    return false;
    }
    }

        return true;
    }

Log in to reply
 

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