摘要: 1 # -*- coding:utf-8 -*- 2 # class ListNode: 3 # def __init__(self, x): 4 # self.val = x 5 # self.next = None 6 7 """双指针的关键是如何保持指针的距离为k-1""" 8 class S 阅读全文
posted @ 2019-05-06 18:34 Parallax 阅读(85) 评论(0) 推荐(0) 编辑
摘要: 1 A= [5, 2, 3, 1, 4] 2 print(sorted(A)) 3 print(A) 4 5 """ 6 [1, 2, 3, 4, 5] 7 [5, 2, 3, 1, 4]""" 8 9 10 11 A=[5, 2, 3, 1, 4] 12 b=A.sort() #A.sort()方 阅读全文
posted @ 2019-05-06 04:13 Parallax 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 1 """复杂度O(n)""" 2 class Solution: 3 def twoSum(self, nums, target): 4 dict1={} 5 for i in range(len(nums)): 6 if nums[i] in dict1: #利用字典查找复杂度为O(1),而暴力 阅读全文
posted @ 2019-05-06 02:25 Parallax 阅读(102) 评论(0) 推荐(0) 编辑