Skip to content

Commit

Permalink
Update sliding_window.py
Browse files Browse the repository at this point in the history
Removed whitespaces
  • Loading branch information
OmMahajan29 committed Sep 25, 2024
1 parent 6a40d5a commit 9f79074
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions greedy_methods/sliding_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,12 @@ def sliding_window(input_string: str) -> int:
if char in char_index_map and char_index_map[char] >= left:
# Move the left pointer to avoid repeating characters
left = char_index_map[char] + 1

# Update the latest index of the character
char_index_map[char] = right

# Calculate the current length of the window
max_len = max(max_len, right - left + 1)

return max_len


if __name__ == "__main__":
import doctest

Expand Down

0 comments on commit 9f79074

Please sign in to comment.