GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — leetcode/cpp/001-010/Palindrome Number.cpp at master · gzc/leetcode Expand file tree/ Copy pathPalindrome Number.cppMore file actions 16 lines (14 loc) · 345 Bytes / Copy pathPalindrome Number.cppFile metadata and controls16 lines (14 loc) · 345 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 class Solution { public: bool isPalindrome(int x) { if (x == 0) return true; if (x < 0) return false; if (x % 10 == 0) return false; int sum = 0; while (x > sum) { sum = sum * 10 + x % 10; x /= 10; } return (x == sum) || (x == sum / 10); } }; |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |