Skip to content

Commit a438545

Browse files
authored
Updated as per requested changes
1 parent d0f1ded commit a438545

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

LeetCode/0076_Minimum_Window_Substring.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@
33
class Solution:
44
def minWindow(self, s: str, t: str) -> str:
55
char_frequency = defaultdict(lambda: 0)
6-
for c in pattern:
6+
for c in t:
77
char_frequency[c] += 1
88
chars_matched = 0
99

1010
start = 0
1111
res = ""
1212

13-
for end in range(len(string)):
14-
right_char = string[end]
15-
if right_char in pattern:
13+
for end in range(len(s)):
14+
right_char = s[end]
15+
if right_char in t:
1616
char_frequency[right_char] -= 1
1717
if char_frequency[right_char] == 0:
1818
chars_matched += 1
1919

2020
while start <= end and chars_matched == len(char_frequency):
2121
if res == "" or end-start+1 < len(res):
22-
res = string[start:end+1]
22+
res = s[start:end+1]
2323

24-
left_char = string[start]
25-
if left_char in pattern:
24+
left_char = s[start]
25+
if left_char in t:
2626
if char_frequency[left_char] == 0:
2727
chars_matched -= 1
2828
char_frequency[left_char] += 1

0 commit comments

Comments
 (0)