# 解题思路:字典建立隐射关系,一一对应 20190302 找工作期间class Solution(object): def isIsomorphic(self, s, t): """ :type s: str :type t: str :rtype: bool """ # 使用字典,pattern ...
分类:
其他好文 时间:
2019-03-17 15:49:28
阅读次数:
166
# 解题思路:字典先存距离信息 20190302 找工作期间# n2class Solution: def numberOfBoomerangs(self, points): """ :type points: List[List[int]] :rtype: int """ def dis( poi ...
分类:
其他好文 时间:
2019-03-17 15:44:41
阅读次数:
173
# 解题思路:字典存储计数信息 20190302 找工作期间class Solution(object): def frequencySort(self, s): """ :type s: str :rtype: str """ dict1 = {} result = str() for i in ...
分类:
其他好文 时间:
2019-03-17 15:43:42
阅读次数:
139
# 解题思路:字典存储计数状态 20190302 找工作期间class Solution(object): def containsDuplicate(self, nums): """ :type nums: List[int] :rtype: bool """ record = {} for i ...
分类:
其他好文 时间:
2019-03-17 15:36:12
阅读次数:
132
# 解题思路:字典存储计数信息 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 ...
分类:
其他好文 时间:
2019-03-17 15:35:10
阅读次数:
128
# 解题思路:字典解决其对应关系 20190302 找工作期间class Solution(object): def isAnagram(self, s, t): """ :type s: str :type t: str :rtype: bool """ #字母异位词指字母相同,但排列不同的字符串 ...
分类:
其他好文 时间:
2019-03-17 15:26:31
阅读次数:
138
# 解题思路:字典 20190302 找工作期间class Solution(object): def intersect(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[int] ...
分类:
其他好文 时间:
2019-03-17 15:25:58
阅读次数:
120
#coding=utf-8# 解题思路: 斜率查找表 20190302 找工作期间# Definition for a point.# class Point(object):# def __init__(self, a=0, b=0):# self.x = a# self.y = bclass S ...
分类:
其他好文 时间:
2019-03-17 15:25:43
阅读次数:
158
# 解题思路:用查找表(集合),保存其K个值的状态 遍历查找表时加上了限制条件T 20190302 找工作期间class Solution(object): def containsNearbyAlmostDuplicate(self, nums, k, t): """ :type nums: Li ...
分类:
其他好文 时间:
2019-03-17 15:19:40
阅读次数:
166
#coding=utf-8# 递归# 深度优先遍历,找全路径 20190306 找工作期间class Solution1(object): def uniquePaths(self, m, n): """ :type m: int :type n: int :rtype: int """ if m ...
分类:
其他好文 时间:
2019-03-17 13:52:06
阅读次数:
162