01 2019 档案

[leetcode 14] 最长公共前缀
摘要:写一个函数可以查找字符串中的最长公共字符。 示例: 输入:["flower","flow","flight"] 输出:"fl" 输入:["dog","racecar","car"] 输出:" " (不存在公共的字符串) 代码: 阅读全文

posted @ 2019-01-31 11:23 女士品茶 阅读(119) 评论(0) 推荐(0)

[leetcode 008] 字符串转换整数
摘要:实现一个能将字符串转换成整数的函数。 示例: 输入:"42" 输出:42 输入:“ -42” 输出:-42 输入:"words with 987" 输出:0 代码: 参考链接:https://github.com/qiyuangong/leetcode/blob/master/python/008_ 阅读全文

posted @ 2019-01-31 00:45 女士品茶 阅读(277) 评论(0) 推荐(0)

[leetcode 005] 最长回文字符串
摘要:给定一个字符串s,在其中寻找它的最长回文字符串,可以假设s的最长长度为1000。 例如: 输入:babad 输出:bab (或aba) 代码 (参考链接 https://mp.weixin.qq.com/s?timestamp=1548727459&src=3&ver=1&signature=VLR 阅读全文

posted @ 2019-01-29 10:00 女士品茶 阅读(109) 评论(0) 推荐(0)

[leetcode 004] 寻找两个有序数组的中位数
摘要:题目:给定两个有序数组,找出它们合并后所得数组的中位数。 例如: nums1=[1,3] nums2=[2] 中位数为2; nums1=[1,2] nums2=[3,4] 中位数为: (2+3)/2=2.5. 阅读全文

posted @ 2019-01-28 10:25 女士品茶 阅读(175) 评论(0) 推荐(0)

[leetcode 001] 两数之和
摘要:给定一个整数数组 nums 和一个目标值 target,在该数组中找出和为目标值的两个整数,并返回他们的数组下标。 :type target: int :rtype: List[int] 阅读全文

posted @ 2019-01-27 09:55 女士品茶 阅读(107) 评论(0) 推荐(0)