class Solution { public: bool(int x){ if (x < 0) returnfalse; if (x == 0) returntrue; int base = 1; int n = x; while (n /= 10) base *= 10; n = x; while (n) { int left = n / base; int right = n % 10; if (left != right) returnfalse; n -= base * left; n /= 10; base /= 100; } returntrue; } };
近期评论