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

浙公网安备 33010602011771号