diff --git a/greedy_methods/sliding_window.py b/greedy_methods/sliding_window.py index 1f877111e5b2..a7b062b44630 100644 --- a/greedy_methods/sliding_window.py +++ b/greedy_methods/sliding_window.py @@ -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