上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 15 下一页
摘要: #coding=utf-8# 解题思路:栈 20190302 找工作期间class Solution(object): def isValid(self, s): """ :type s: str :rtype: bool """ stack = [] for i in s : if i == "( 阅读全文
posted @ 2019-03-17 15:55 AceKo 阅读(108) 评论(0) 推荐(0)
摘要: # 1、在有序表中查找两数组指定的和,双指针法# 2、滑动窗口 : 连续子数组之和# 3、二分查找 : 顺序数组中查找特定的值# 4、递归程序的真正的构建是从底向上的,这就是为什么递归终止条件要写在最前面# 参见 反转链表的递归程序 LeetCode206# 5、 链表归并排序的递归过程,要好好体会 阅读全文
posted @ 2019-03-17 14:46 AceKo 阅读(481) 评论(0) 推荐(0)
摘要: # 解题思路:字典存储计数信息 20190302 找工作期间class Solution(object): def fourSumCount(self, A, B, C, D): res2 = {} res = 0 for i in C: for j in D: res2[i + j] = res2 阅读全文
posted @ 2019-03-17 14:45 AceKo 阅读(104) 评论(0) 推荐(0)
摘要: # 解题思路:字典存储计数信息 20190302 找工作期间class Solution(object): def frequencySort(self, s): """ :type s: str :rtype: str """ dict1 = {} result = str() for i in 阅读全文
posted @ 2019-03-17 14:44 AceKo 阅读(139) 评论(0) 推荐(0)
摘要: # 解题思路:字典 20190302 找工作期间class Solution(object): def intersect(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[int] 阅读全文
posted @ 2019-03-17 14:43 AceKo 阅读(140) 评论(0) 推荐(0)
摘要: # 解题思路:字典先存距离信息 20190302 找工作期间# n2class Solution: def numberOfBoomerangs(self, points): """ :type points: List[List[int]] :rtype: int """ def dis( poi 阅读全文
posted @ 2019-03-17 14:43 AceKo 阅读(157) 评论(0) 推荐(0)
摘要: # 解题思路:无 20190302 找工作期间class Solution(object): def intersection(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[in 阅读全文
posted @ 2019-03-17 14:42 AceKo 阅读(89) 评论(0) 推荐(0)
摘要: # 解题思路:字典解决其对应关系 20190302 找工作期间class Solution(object): def isAnagram(self, s, t): """ :type s: str :type t: str :rtype: bool """ #字母异位词指字母相同,但排列不同的字符串 阅读全文
posted @ 2019-03-17 14:39 AceKo 阅读(194) 评论(0) 推荐(0)
摘要: # 解题思路:字典解决其对应关系 20190302 找工作期间#使用字典,pattern当key,str当value,形成配对class Solution(object): def wordPattern(self, pattern, str): """ :type pattern: str :ty 阅读全文
posted @ 2019-03-17 14:39 AceKo 阅读(118) 评论(0) 推荐(0)
摘要: # 解题思路:用查找表(集合),保存其K个值的状态 遍历查找表时加上了限制条件T 20190302 找工作期间class Solution(object): def containsNearbyAlmostDuplicate(self, nums, k, t): """ :type nums: Li 阅读全文
posted @ 2019-03-17 14:38 AceKo 阅读(334) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 15 下一页