![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python LeetCode
qq_37373452
这个作者很懒,什么都没留下…
展开
-
LeetCode第四天
28.实现strStr()class Solution: def strStr(self, haystack, needle): """ :type haystack: str :type needle: str :rtype: int """ if(needle==''): ...原创 2018-08-31 20:32:18 · 113 阅读 · 0 评论 -
LeetCode第九天
125.验证回文字符串class Solution(object): def isPalindrome(self, s): """ :type s: str :rtype: bool """ str_list=[] for l in list(s): if l.is...原创 2018-09-06 23:15:24 · 99 阅读 · 0 评论 -
LeetCode第七天
星期日做老师给的任务去了,就没有做着一块,以后尽量还是要做104. 二叉树的最大深度# Definition for a binary tree node.# class TreeNode:# def __init__(self, x):# self.val = x# self.left = None# self.righ...原创 2018-09-04 00:01:48 · 82 阅读 · 0 评论 -
LeetCode第六天
83. 删除排序链表中的重复元素# Definition for singly-linked list.# class ListNode:# def __init__(self, x):# self.val = x# self.next = Noneclass Solution: def deleteDuplicates(self,...原创 2018-09-03 23:58:25 · 127 阅读 · 0 评论 -
Leetcode第十天
160. 相交链表# Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x# self.next = Noneclass Solution(object): def getIntersecti...原创 2018-09-07 22:09:38 · 84 阅读 · 0 评论 -
LeetCode第八天
108. 将有序数组转换为二叉搜索树# Definition for a binary tree node.# class TreeNode:# def __init__(self, x):# self.val = x# self.left = None# self.right = Noneclass Solution:...原创 2018-09-04 21:50:47 · 104 阅读 · 0 评论 -
LeetCode第三天
21.合并两个有序列表# Definition for singly-linked list.# class ListNode:# def __init__(self, x):# self.val = x# self.next = Noneclass Solution: def mergeTwoLists(self, l1, l2)...原创 2018-08-29 20:35:29 · 105 阅读 · 0 评论 -
LeetCode第二天
13.罗马数字转整数class Solution: def romanToInt(self, s): """ :type s: str :rtype: int """ dico={'I':1,'V':5,'X':10,'L':50,'C':100,'D':500,'M':1000,'IV':4,'IX':...原创 2018-08-29 20:31:51 · 114 阅读 · 0 评论 -
LeetCode第一天
1.两数之和class Solution: def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ for i in range(len(nums))...原创 2018-08-29 20:29:05 · 88 阅读 · 0 评论 -
LeetCode第五天
53.最大子序和class Solution: def maxSubArray(self, nums): """ :type nums: List[int] :rtype: int """ for i in range(1,len(nums)): if nums[i-1]>0...原创 2018-08-31 20:40:39 · 142 阅读 · 0 评论 -
LeetCode第十一天
11. 盛最多水的容器class Solution(object): def maxArea(self, height): """ :type height: List[int] :rtype: int """ #从左往右逼近,如果左边小,则左边右移,否则右边左移 max_area=...原创 2018-09-13 22:53:23 · 107 阅读 · 0 评论