首页 > 代码库 > LeetCode Palidrome Number

LeetCode Palidrome Number

class Solution {public:    bool isPalindrome(int x) {        if (x < 0) return false;        int pow = 1;        int t = x;        int cnt = 1;        while(t /= 10) {            pow *= 10;            cnt++;        }        t = x;        cnt = cnt / 2;        while (cnt--) {            if ((t / pow % 10) != t % 10) return false;            t = t / 10;            pow /= 100;        }        return true;    }};

500ms+,怎么会那么长时间