摘要:
077 Combinations这道题纯dfs, 但是在 Line 13处做了个剪枝 从84ms 提高到68 ms 1 class Solution: 2 def __init__(self): 3 self.ans = [] 4 5 def combine... 阅读全文
摘要:
188 Best Time to Buy and Sell Stock IV这道题是我目前为止最得意的一道题了 看看自己的运行时间已经超出所有 Python的解法 自己都醉了class Solution: def __init__(self): self.start = 0 ... 阅读全文
摘要:
165 Compare Version Numbers用python处理字符串还是比较简单的class Solution: # @param {string} version1 # @param {string} version2 # @return {integer} de... 阅读全文
摘要:
076 Minimum Window Substring这道题就是用一个dictionary来跟踪有多少还需要Match的字母以及当前需要match的次数。 再用一个queue 来记录哪些字幕被Match了以及他们被match的顺序from collections import defaultdic... 阅读全文
摘要:
115 Distinct Subsequences这道题是dp, 我定义的dp[i][j] 为用t[:i] 和s[:j] 的disitinct subsequence排列数class Solution: # @param {string} s # @param {string} t ... 阅读全文