55. Jump Gamehttps://leetcode.com/problems/jump-game/
topics:dynamic programming,greedy
solution1: greedy - local optimization --》 global optimization
贪心,每到一个位置就更新当前可到达的最远距离;初始化为起点0
56. Merge Intervalshttps://leetcode.com/problems/merge-intervals/
怎么给intervals排序?
intervals.sort( ) #Python 的sort()函数默认就会按照子列表的第一个元素(索引 0)进行排序,如果第一个相等,再比第二个。
sorted(intervals)
intervals.sort(key=lambda x: x[0])
205. Isomorphic Stringshttps://leetcode.com/problems/isomorphic-strings/
写出来mapping
dict = {}
for char1, char2 in zip(s, t):
s[char1] = char2
t[char2] = char1
290. Word Patternhttps://leetcode.com/problems/word-pattern/是205的升级模式,添加的东西时words = s.split(" ")
242. Valid Anagramhttps://leetcode.com/problems/valid-anagram/这道题还挺简单的
1. Two Sumhttps://leetcode.com/problems/two-sum/
暴力solution + hash table
for target - x in dict: #这里是找key in the dictionary
dict[x] = idx
202. Happy Numberhttps://leetcode.com/problems/happy-number/需要复习 - 没能一次写出来