摘要: 双指针法: class Solution: def maxArea(self, height) -> int: if len(height)<=1: return 0 #双指针法 i,j,S=0,len(height)-1,0 while i<j: if height[i]<height[j]: S 阅读全文
posted @ 2019-10-07 22:19 欣姐姐 阅读(213) 评论(0) 推荐(0) 编辑
摘要: ——2019.10.7 阅读全文
posted @ 2019-10-07 21:33 欣姐姐 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 我自己写的超时了。。。。 class Solution: def threeSum(self, nums) : nums.sort() #print(nums) nums1=[] s=[] if nums.count(0)>=3: s.append([0,0,0]) for i in range(l 阅读全文
posted @ 2019-10-07 19:51 欣姐姐 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 执行用时 :80 ms, 在所有 Python3 提交中击败了43.61%的用户 内存消耗 :13.9 MB, 在所有 Python3 提交中击败了5.24%的用户 别人48ms的例子: class Solution: def commonChars(self, A: List[str]) -> L 阅读全文
posted @ 2019-10-07 17:47 欣姐姐 阅读(201) 评论(0) 推荐(0) 编辑
摘要: 执行用时 :92 ms, 在所有 Python3 提交中击败了45.21%的用户 内存消耗 :13.9 MB, 在所有 Python3 提交中击败了5.06%的用户 ——2019.10.7 阅读全文
posted @ 2019-10-07 16:39 欣姐姐 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 执行用时 :76 ms, 在所有 Python3 提交中击败了55.32%的用户 内存消耗 :13.9 MB, 在所有 Python3 提交中击败了5.02%的用户 ——2019.10.7 阅读全文
posted @ 2019-10-07 16:26 欣姐姐 阅读(139) 评论(0) 推荐(0) 编辑
摘要: class Solution: def findMedianSortedArrays(self, nums1, nums2) -> float: c=sorted(nums1+nums2) if len(c)%2==0: return (c[len(c)//2]+c[len(c)//2-1])/2 阅读全文
posted @ 2019-10-07 13:45 欣姐姐 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 别人的想法。 ——2019.10.7 阅读全文
posted @ 2019-10-07 11:34 欣姐姐 阅读(247) 评论(0) 推荐(0) 编辑
摘要: 漂亮数组: 对于某些固定的 N,如果数组 A 是整数 1, 2, ..., N 组成的排列,使得: 对于每个 i < j,都不存在 k 满足 i < k < j 使得 A[k] * 2 = A[i] + A[j]。 那么数组 A 是漂亮数组。 给定 N,返回任意漂亮数组 A(保证存在一个)。 这个如 阅读全文
posted @ 2019-10-07 11:29 欣姐姐 阅读(454) 评论(0) 推荐(0) 编辑