LeetCode刷题(49)--Minimum Window Substring
2017-12-31 21:46
393 查看
class Solution(object): def minWindow(self, s, t): """ :type s: str :type t: str :rtype: str """ need, missing = collections.Counter(t), len(t) i = I = J = 0 for j, c in enumerate(s, 1): missing -= need[c] > 0 need[c] -= 1 if not missing: while i < j and need[s[i]] < 0: need[s[i]] += 1 i += 1 if not J or j - i <= J - I: I, J = i, j return s[I:J]
相关文章推荐
- LeetCode 76 minimum window substring
- LeetCode | Minimum Window Substring
- Leetcode 76 Minimum Window Substring(最小窗口的子串)
- leetcode hard模式专杀之76 Minimum Window Substring
- Leetcode Minimum Window Substring
- LeetCode 笔记系列16.1 Minimum Window Substring [从O(N*M), O(NlogM)到O(N),人生就是一场不停的战斗]
- leetcode---minimum-window-substring---贪心
- LeetCode | Minimum Window Substring
- LeetCode Minimum Window Substring(two pointer)
- LeetCode76 Minimum Window Substring(两种解法)
- LeetCode 76 Minimum Window Substring
- LeetCode Minimum Window Substring
- 【LeetCode】Minimum Window Substring
- [LeetCode][Java] Minimum Window Substring
- LeetCode —— Minimum Window Substring
- Minimum Window Substring -- LeetCode
- LeetCode(76)Minimum Window Substring
- [Leetcode]Substring with Concatenation of All Words & Minimum Window Substring
- LeetCode OJ Minimum Window Substring
- LeetCode -- Minimum Window Substring