摘要:
class Solution { public: bool isPalindrome(int x) { if(x < 0) return false; if(x == 0) return true; vector<int>nums; while(x) nums.push_back(x % 10), 阅读全文
posted @ 2020-11-03 15:41
0xcf
阅读(35)
评论(0)
推荐(0)
摘要:
class Solution { public: int myAtoi(string s) { if(s.empty()) return 0; // 去掉空格 int k = 0; while(s[k] == ' ') k++; bool flag = false; if(s[k] == '-') 阅读全文
posted @ 2020-11-03 15:39
0xcf
阅读(124)
评论(0)
推荐(0)
摘要:
题目思路 翻转一个整数,主要注意溢出的判断 实现代码 class Solution { public: int reverse(int x) { if(!x) return x; int res = 0; while(x) { if(x > 0 && res > (INT_MAX - x % 10) 阅读全文
posted @ 2020-11-03 15:12
0xcf
阅读(42)
评论(0)
推荐(0)

浙公网安备 33010602011771号