> ## Documentation Index
> Fetch the complete documentation index at: https://leetcode-py.wisl.dev/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> leetcode-py is a Python LeetCode practice environment generator with one CLI: lcpy. It is not a service or platform.
> Each problem is a directory under leetcode/ with README.md, solution.py, test_solution.py, helpers.py, and playground.ipynb. lcpy gen creates them from JSON templates bundled with the package.
> Examples are backed by tests; copy them verbatim.

# Sliding Window in Python with Tests

> All 63 Sliding Window LeetCode problems with tested Python solutions.

Sliding Window holds 63 problems (6 Easy, 44 Medium, 13 Hard).
Generate any of them into the current directory with `lcpy gen -n <number>`.

<div className="sd-catalog-table">
  | # | Problem | Difficulty | Solution |
  | - | - | - | - |
  | 3 | [Longest Substring Without Repeating Characters](/problems/longest-substring-without-repeating-characters) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_substring_without_repeating_characters/solution.py) |
  | 30 | [Substring with Concatenation of All Words](/problems/substring-with-concatenation-of-all-words) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/substring_with_concatenation_of_all_words/solution.py) |
  | 76 | [Minimum Window Substring](/problems/minimum-window-substring) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_window_substring/solution.py) |
  | 159 | [Longest Substring with At Most Two Distinct Characters](/problems/longest-substring-with-at-most-two-distinct-characters) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_substring_with_at_most_two_distinct_characters/solution.py) |
  | 187 | [Repeated DNA Sequences](/problems/repeated-dna-sequences) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/repeated_dna_sequences/solution.py) |
  | 209 | [Minimum Size Subarray Sum](/problems/minimum-size-subarray-sum) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_size_subarray_sum/solution.py) |
  | 219 | [Contains Duplicate II](/problems/contains-duplicate-ii) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/contains_duplicate_ii/solution.py) |
  | 220 | [Contains Duplicate III](/problems/contains-duplicate-iii) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/contains_duplicate_iii/solution.py) |
  | 239 | [Sliding Window Maximum](/problems/sliding-window-maximum) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/sliding_window_maximum/solution.py) |
  | 340 | [Longest Substring with At Most K Distinct Characters](/problems/longest-substring-with-at-most-k-distinct-characters) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_substring_with_at_most_k_distinct_characters/solution.py) |
  | 395 | [Longest Substring with At Least K Repeating Characters](/problems/longest-substring-with-at-least-k-repeating-characters) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_substring_with_at_least_k_repeating_characters/solution.py) |
  | 413 | [Arithmetic Slices](/problems/arithmetic-slices) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/arithmetic_slices/solution.py) |
  | 424 | [Longest Repeating Character Replacement](/problems/longest-repeating-character-replacement) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_repeating_character_replacement/solution.py) |
  | 438 | [Find All Anagrams in a String](/problems/find-all-anagrams-in-a-string) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_all_anagrams_in_a_string/solution.py) |
  | 480 | [Sliding Window Median](/problems/sliding-window-median) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/sliding_window_median/solution.py) |
  | 487 | [Max Consecutive Ones II](/problems/max-consecutive-ones-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/max_consecutive_ones_ii/solution.py) |
  | 567 | [Permutation in String](/problems/permutation-in-string) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/permutation_in_string/solution.py) |
  | 594 | [Longest Harmonious Subsequence](/problems/longest-harmonious-subsequence) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_harmonious_subsequence/solution.py) |
  | 632 | [Smallest Range Covering Elements from K Lists](/problems/smallest-range-covering-elements-from-k-lists) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/smallest_range_covering_elements_from_k_lists/solution.py) |
  | 643 | [Maximum Average Subarray I](/problems/maximum-average-subarray-i) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_average_subarray_i/solution.py) |
  | 658 | [Find K Closest Elements](/problems/find-k-closest-elements) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_k_closest_elements/solution.py) |
  | 683 | [K Empty Slots](/problems/k-empty-slots) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/k_empty_slots/solution.py) |
  | 713 | [Subarray Product Less Than K](/problems/subarray-product-less-than-k) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/subarray_product_less_than_k/solution.py) |
  | 718 | [Maximum Length of Repeated Subarray](/problems/maximum-length-of-repeated-subarray) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_length_of_repeated_subarray/solution.py) |
  | 727 | [Minimum Window Subsequence](/problems/minimum-window-subsequence) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_window_subsequence/solution.py) |
  | 837 | [New 21 Game](/problems/new-21-game) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/new_21_game/solution.py) |
  | 862 | [Shortest Subarray with Sum at Least K](/problems/shortest-subarray-with-sum-at-least-k) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/shortest_subarray_with_sum_at_least_k/solution.py) |
  | 904 | [Fruit Into Baskets](/problems/fruit-into-basket) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/fruit_into_basket/solution.py) |
  | 930 | [Binary Subarrays With Sum](/problems/binary-subarrays-with-sum) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/binary_subarrays_with_sum/solution.py) |
  | 978 | [Longest Turbulent Subarray](/problems/longest-turbulent-subarray) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_turbulent_subarray/solution.py) |
  | 992 | [Subarrays with K Different Integers](/problems/subarrays-with-k-different-integers) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/subarrays_with_k_different_integers/solution.py) |
  | 995 | [Minimum Number of K Consecutive Bit Flips](/problems/minimum-number-of-k-consecutive-bit-flips) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_number_of_k_consecutive_bit_flips/solution.py) |
  | 1004 | [Max Consecutive Ones III](/problems/max-consecutive-ones-iii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/max_consecutive_ones_iii/solution.py) |
  | 1052 | [Grumpy Bookstore Owner](/problems/grumpy-bookstore-owner) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/grumpy_bookstore_owner/solution.py) |
  | 1100 | [Find K-Length Substrings With No Repeated Characters](/problems/find-k-length-substrings-with-no-repeated-characters) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_k_length_substrings_with_no_repeated_characters/solution.py) |
  | 1208 | [Get Equal Substrings Within Budget](/problems/get-equal-substrings-within-budget) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/get_equal_substrings_within_budget/solution.py) |
  | 1248 | [Count Number of Nice Subarrays](/problems/count-number-of-nice-subarrays) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/count_number_of_nice_subarrays/solution.py) |
  | 1343 | [Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold](/problems/number-of-sub-arrays-of-size-k-and-average-greater-than-or-equal-to-threshold) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_sub_arrays_of_size_k_and_average_greater_than_or_equal_to_threshold/solution.py) |
  | 1358 | [Number of Substrings Containing All Three Characters](/problems/number-of-substrings-containing-all-three-characters) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/number_of_substrings_containing_all_three_characters/solution.py) |
  | 1423 | [Maximum Points You Can Obtain from Cards](/problems/maximum-points-you-can-obtain-from-cards) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_points_you_can_obtain_from_cards/solution.py) |
  | 1425 | [Constrained Subsequence Sum](/problems/constrained-subsequence-sum) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/constrained_subsequence_sum/solution.py) |
  | 1438 | [Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit](/problems/longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_continuous_subarray_with_absolute_diff_less_than_or_equal_to_limit/solution.py) |
  | 1456 | [Maximum Number of Vowels in a Substring of Given Length](/problems/maximum-number-of-vowels-in-a-substring-of-given-length) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_number_of_vowels_in_a_substring_of_given_length/solution.py) |
  | 1652 | [Defuse the Bomb](/problems/defuse-the-bomb) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/defuse_the_bomb/solution.py) |
  | 1658 | [Minimum Operations to Reduce X to Zero](/problems/minimum-operations-to-reduce-x-to-zero) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_operations_to_reduce_x_to_zero/solution.py) |
  | 1838 | [Frequency of the Most Frequent Element](/problems/frequency-of-the-most-frequent-element) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/frequency_of_the_most_frequent_element/solution.py) |
  | 1871 | [Jump Game VII](/problems/jump-game-vii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/jump_game_vii/solution.py) |
  | 1888 | [Minimum Number of Flips to Make the Binary String Alternating](/problems/minimum-number-of-flips-to-make-the-binary-string-alternating) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_number_of_flips_to_make_the_binary_string_alternating/solution.py) |
  | 1984 | [Minimum Difference Between Highest and Lowest of K Scores](/problems/minimum-difference-between-highest-and-lowest-of-k-scores) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_difference_between_highest_and_lowest_of_k_scores/solution.py) |
  | 2009 | [Minimum Number of Operations to Make Array Continuous](/problems/minimum-number-of-operations-to-make-array-continuous) | Hard | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_number_of_operations_to_make_array_continuous/solution.py) |
  | 2134 | [Minimum Swaps to Group All 1's Together II](/problems/minimum-swaps-to-group-all-1s-together-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_swaps_to_group_all_1s_together_ii/solution.py) |
  | 2379 | [Minimum Recolors to Get K Consecutive Black Blocks](/problems/minimum-recolors-to-get-k-consecutive-black-blocks) | Easy | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_recolors_to_get_k_consecutive_black_blocks/solution.py) |
  | 2401 | [Longest Nice Subarray](/problems/longest-nice-subarray) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/longest_nice_subarray/solution.py) |
  | 2461 | [Maximum Sum of Distinct Subarrays With Length K](/problems/maximum-sum-of-distinct-subarrays-with-length-k) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_sum_of_distinct_subarrays_with_length_k/solution.py) |
  | 2516 | [Take K of Each Character From Left and Right](/problems/take-k-of-each-character-from-left-and-right) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/take_k_of_each_character_from_left_and_right/solution.py) |
  | 2779 | [Maximum Beauty of an Array After Applying Operation](/problems/maximum-beauty-of-an-array-after-applying-operation) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/maximum_beauty_of_an_array_after_applying_operation/solution.py) |
  | 2958 | [Length of Longest Subarray With at Most K Frequency](/problems/length-of-longest-subarray-with-at-most-k-frequency) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/length_of_longest_subarray_with_at_most_k_frequency/solution.py) |
  | 2962 | [Count Subarrays Where Max Element Appears at Least K Times](/problems/count-subarrays-where-max-element-appears-at-least-k-times) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/count_subarrays_where_max_element_appears_at_least_k_times/solution.py) |
  | 3097 | [Shortest Subarray With OR at Least K II](/problems/shortest-subarray-with-or-at-least-k-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/shortest_subarray_with_or_at_least_k_ii/solution.py) |
  | 3191 | [Minimum Operations to Make Binary Array Elements Equal to One I](/problems/minimum-operations-to-make-binary-array-elements-equal-to-one-i) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/minimum_operations_to_make_binary_array_elements_equal_to_one_i/solution.py) |
  | 3208 | [Alternating Groups II](/problems/alternating-groups-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/alternating_groups_ii/solution.py) |
  | 3254 | [Find the Power of K-Size Subarrays I](/problems/find-the-power-of-k-size-subarrays-i) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/find_the_power_of_k_size_subarrays_i/solution.py) |
  | 3306 | [Count of Substrings Containing Every Vowel and K Consonants II](/problems/count-of-substrings-containing-every-vowel-and-k-consonants-ii) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/count_of_substrings_containing_every_vowel_and_k_consonants_ii/solution.py) |
</div>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.