Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
25 lines (20 loc) · 705 Bytes

File metadata and controls

25 lines (20 loc) · 705 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import collections
from typing import List
class Solution:
def minWindow(self, s: str, t: str) -> str:
def contains(s_substr_lst: List, t_lst: List):
for t_elem in t_lst:
if t_elem in s_substr_lst:
s_substr_lst.remove(t_elem)
else:
return False
return True
if not s or not t:
return ''
window_size = len(t)
for size in range(window_size, len(s) + 1):
for left in range(len(s) - size + 1):
s_substr = s[left:left + size]
if contains(list(s_substr), list(t)):
return s_substr
return ''
Morty Proxy This is a proxified and sanitized view of the page, visit original site.