- 博客(4)
- 收藏
- 关注
原创 LeetCode005. Longest Palindromic Substring
Given a strings, find the longest palindromic substring ins. You may assume that the maximum length ofsis 1000. Example 1: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Exam...
2019-09-10 01:09:31
120
原创 LeetCode003.Longest Substring Without Repeating Characters
class Solution(object): def lengthOfLongestSubstring(self, s): """ :type s: str :rtype: int """ nlist=[] maxl=min(len(s),1) for i ...
2019-09-09 01:25:43
116
原创 Python find()和index()区别
find和index用法是相同的,不过区别在于没有找到对应字符串后,find()返回-1,index()会抛出异常 str.index(str, beg=0, end=len(string)) str.find(str, beg=0, end=len(string)) ...
2019-09-09 01:25:26
1460
原创 LeetCode002. Add Two Numbers
discuss中的优秀方法: def addTwoNumbers(self, l1, l2): carry = 0; res = n = ListNode(0); while l1 or l2 or carry: if l1: carry += l1.val ...
2019-09-08 00:38:35
131
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人