Skip to content

Commit 463b339

Browse files
Refactor window shrinking condition in sliding window logic.
Removed redundant check on `left <= right` since the loop condition is already governed by the matching character count. This simplifies the logic without affecting functionality.
1 parent 3764345 commit 463b339

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sliding Window/minimum_window_substring.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def min_window(s: str, t: str) -> str:
3636
matched_characters += 1
3737

3838
# Try to shrink the window until it ceases to be 'desirable'
39-
while left <= right and matched_characters == char_count_needed:
39+
while matched_characters == char_count_needed:
4040
char = s[left]
4141

4242
# Save the smallest window until now

0 commit comments

Comments
 (0)