摘要: 题意: Determine whether an integer is a palindrome. Do this without extra space. (Easy) 分析: 自己考虑的方法是利用Reverse Integer,然后查看rev与x是否相等,注意负数和0的判断(这里WA了一次) 代 阅读全文
posted @ 2016-08-03 23:32 wangxiaobao1114 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 题意: Implement atoi to convert a string to an integer. (Easy) 分析: 就是注意各种特殊情况,边界情况的判断,见代码注释。 阅读全文
posted @ 2016-08-03 21:55 wangxiaobao1114 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 题意: Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 (Easy) 分析: 思路很简单,注意特殊情况如10,100等和int溢出情况即可; 开始采用的是用一个数组把 阅读全文
posted @ 2016-08-03 21:49 wangxiaobao1114 阅读(119) 评论(0) 推荐(0) 编辑