> ## 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>`.

| # | Problem | Difficulty | Solution |
| - | - | - | - |
| 3 | [Longest Substring Without Repeating Characters](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/problems/arithmetic-slices) | Medium | [solution.py](https://github.com/wislertt/leetcode-py/blob/main/leetcode/arithmetic_slices/solution.py) |
| 424 | [Longest Repeating Character Replacement](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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](https://leetcode-py.wisl.dev/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) |


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