- 博客(3)
- 资源 (1)
- 收藏
- 关注
原创 Leetcode刷题记录 · No.5 Longest Palindromic Substring(最长回文子串)
原题 Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring. 即给定一个字符串,找到这个字符串中最长的回
2016-10-19 16:36:55 190
原创 Leetcode刷题记录 · No.8 String to Integer(atoi)
原题Implement atoi to convert a string to an integer. 即实现一个atoi函数注意事项转换不难。 但要注意以下四个问题: - 处理前置位的空格符 - 判断正负 - 判断是否溢出并处理(超出则输出INT_MAX 或者 INT_MIN) - 处理非法输入(除一开始的空格和正负号外,一遇到非数字字符即返回0)源代码class Solutio
2016-10-18 20:32:53 116
原创 Leetcode刷题记录 · No.7 Reverse Integer
原题Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321注意事项 需要考虑符号 需要考虑末位0的数,如100,1200等 需要考虑溢出情况,在本题中如果有溢出返回0 解题思路 取符号,再将原数取绝对值;全程对正数进行处理,最后返回结果时再考虑正负; 逐位循环,每次循环中有
2016-10-13 23:12:11 187
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人