作者:zykBlog

链接:https://www.cnblogs.com/zykBlog

来源:https://www.cnblogs.com/zykBlog

著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

摘要: 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 阅读(32) 评论(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 阅读(120) 评论(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 阅读(36) 评论(0) 推荐(0) 编辑

作者:zykBlog

链接:https://www.cnblogs.com/zykBlog

来源:https://www.cnblogs.com/zykBlog

著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。