【LeetCode】09.回文数

class Solution {
public:
    bool isPalindrome(int x) {
        string str;
        str=to_string(x);
        int len=str.size();
        for(int i=0;i<=len/2;i++){
            if(str[i]!=str[len-i-1]) return false;
        }  
        return true;
    }
};

  还没有解决的问题:你能不将整数转为字符串来解决这个问题吗?(思考ing)

posted @ 2018-05-09 21:41  Little_Shel  阅读(98)  评论(0编辑  收藏  举报