Skip to content
LEETFLIX

method

Sliding Window — animated LeetCode walkthroughs

LeetCode problems solved with Sliding Window. Browse the complete tag, then watch the algorithm move — step-by-step animation, Python and Go.

172 problems · 147 animated · 25 locked

Start with a walkthrough

Full Window index

  1. 3Longest Substring Without Repeating CharactersWatch
  2. 30Substring with Concatenation of All WordsWatch
  3. 76Minimum Window SubstringWatch
  4. 159Longest Substring with At Most Two Distinct CharactersLocked
  5. 187Repeated DNA SequencesWatch
  6. 209Minimum Size Subarray SumWatch
  7. 219Contains Duplicate IIWatch
  8. 220Contains Duplicate IIIWatch
  9. 239Sliding Window MaximumWatch
  10. 340Longest Substring with At Most K Distinct CharactersLocked
  11. 395Longest Substring with At Least K Repeating CharactersWatch
  12. 413Arithmetic SlicesWatch
  13. 424Longest Repeating Character ReplacementWatch
  14. 438Find All Anagrams in a StringWatch
  15. 480Sliding Window MedianWatch
  16. 487Max Consecutive Ones IILocked
  17. 567Permutation in StringWatch
  18. 594Longest Harmonious SubsequenceWatch
  19. 632Smallest Range Covering Elements from K ListsWatch
  20. 643Maximum Average Subarray IWatch
  21. 658Find K Closest ElementsWatch
  22. 683K Empty SlotsLocked
  23. 689Maximum Sum of 3 Non-Overlapping SubarraysWatch
  24. 713Subarray Product Less Than KWatch
  25. 718Maximum Length of Repeated SubarrayWatch
  26. 727Minimum Window SubsequenceLocked
  27. 837New 21 GameWatch
  28. 862Shortest Subarray with Sum at Least KWatch
  29. 904Fruit Into BasketsWatch
  30. 930Binary Subarrays With SumWatch
  31. 978Longest Turbulent SubarrayWatch
  32. 992Subarrays with K Different IntegersWatch
  33. 995Minimum Number of K Consecutive Bit FlipsWatch
  34. 1004Max Consecutive Ones IIIWatch
  35. 1016Binary String With Substrings Representing 1 To NWatch
  36. 1031Maximum Sum of Two Non-Overlapping SubarraysWatch
  37. 1040Moving Stones Until Consecutive IIWatch
  38. 1044Longest Duplicate SubstringWatch
  39. 1052Grumpy Bookstore OwnerWatch
  40. 1100Find K-Length Substrings With No Repeated CharactersLocked
  41. 1151Minimum Swaps to Group All 1's TogetherLocked
  42. 1156Swap For Longest Repeated Character SubstringWatch
  43. 1176Diet Plan PerformanceLocked
  44. 1208Get Equal Substrings Within BudgetWatch
  45. 1234Replace the Substring for Balanced StringWatch
  46. 1248Count Number of Nice SubarraysWatch
  47. 1297Maximum Number of Occurrences of a SubstringWatch
  48. 1343Number of Sub-arrays of Size K and Average Greater than or Equal to ThresholdWatch
  49. 1358Number of Substrings Containing All Three CharactersWatch
  50. 1423Maximum Points You Can Obtain from CardsWatch
  51. 1425Constrained Subsequence SumWatch
  52. 1438Longest Continuous Subarray With Absolute Diff Less Than or Equal to LimitWatch
  53. 1456Maximum Number of Vowels in a Substring of Given LengthWatch
  54. 1477Find Two Non-overlapping Sub-arrays Each With Target SumWatch
  55. 1493Longest Subarray of 1's After Deleting One ElementWatch
  56. 1499Max Value of EquationWatch
  57. 1610Maximum Number of Visible PointsWatch
  58. 1652Defuse the BombWatch
  59. 1658Minimum Operations to Reduce X to ZeroWatch
  60. 1695Maximum Erasure ValueWatch
  61. 1703Minimum Adjacent Swaps for K Consecutive OnesWatch
  62. 1763Longest Nice SubstringWatch
  63. 1838Frequency of the Most Frequent ElementWatch
  64. 1839Longest Substring Of All Vowels in OrderWatch
  65. 1852Distinct Numbers in Each SubarrayLocked
  66. 1871Jump Game VIIWatch
  67. 1876Substrings of Size Three with Distinct CharactersWatch
  68. 1888Minimum Number of Flips to Make the Binary String AlternatingWatch
  69. 1918Kth Smallest Subarray SumLocked
  70. 1956Minimum Time For K Virus Variants to SpreadLocked
  71. 1984Minimum Difference Between Highest and Lowest of K ScoresWatch
  72. 2009Minimum Number of Operations to Make Array ContinuousWatch
  73. 2024Maximize the Confusion of an ExamWatch
  74. 2067Number of Equal Count SubstringsLocked
  75. 2090K Radius Subarray AveragesWatch
  76. 2106Maximum Fruits Harvested After at Most K StepsWatch
  77. 2107Number of Unique Flavors After Sharing K CandiesLocked
  78. 2110Number of Smooth Descent Periods of a StockWatch
  79. 2134Minimum Swaps to Group All 1's Together IIWatch
  80. 2156Find Substring With Given Hash ValueWatch
  81. 2260Minimum Consecutive Cards to Pick UpWatch
  82. 2269Find the K-Beauty of a NumberWatch
  83. 2271Maximum White Tiles Covered by a CarpetWatch
  84. 2302Count Subarrays With Score Less Than KWatch
  85. 2379Minimum Recolors to Get K Consecutive Black BlocksWatch
  86. 2398Maximum Number of Robots Within BudgetWatch
  87. 2401Longest Nice SubarrayWatch
  88. 2411Smallest Subarrays With Maximum Bitwise ORWatch
  89. 2444Count Subarrays With Fixed BoundsWatch
  90. 2461Maximum Sum of Distinct Subarrays With Length KWatch
  91. 2516Take K of Each Character From Left and RightWatch
  92. 2524Maximum Frequency Score of a SubarrayLocked
  93. 2528Maximize the Minimum Powered CityWatch
  94. 2537Count the Number of Good SubarraysWatch
  95. 2555Maximize Win From Two SegmentsWatch
  96. 2653Sliding Subarray BeautyWatch
  97. 2730Find the Longest Semi-Repetitive SubstringWatch
  98. 2743Count Substrings Without Repeating CharacterLocked
  99. 2747Count Zero Request ServersWatch
  100. 2760Longest Even Odd Subarray With ThresholdWatch
  101. 2762Continuous SubarraysWatch
  102. 2779Maximum Beauty of an Array After Applying OperationWatch
  103. 2781Length of the Longest Valid SubstringWatch
  104. 2799Count Complete Subarrays in an ArrayWatch
  105. 2831Find the Longest Equal SubarrayWatch
  106. 2841Maximum Sum of Almost Unique SubarrayWatch
  107. 2875Minimum Size Subarray in Infinite ArrayWatch
  108. 2902Count of Sub-Multisets With Bounded SumWatch
  109. 2904Shortest and Lexicographically Smallest Beautiful StringWatch
  110. 2932Maximum Strong Pair XOR IWatch
  111. 2935Maximum Strong Pair XOR IIWatch
  112. 2953Count Complete SubstringsWatch
  113. 2958Length of Longest Subarray With at Most K FrequencyWatch
  114. 2962Count Subarrays Where Max Element Appears at Least K TimesWatch
  115. 2968Apply Operations to Maximize Frequency ScoreWatch
  116. 2981Find Longest Special Substring That Occurs Thrice IWatch
  117. 2982Find Longest Special Substring That Occurs Thrice IIWatch
  118. 3013Divide an Array Into Subarrays With Minimum Cost IIWatch
  119. 3023Find Pattern in Infinite Stream ILocked
  120. 3037Find Pattern in Infinite Stream IILocked
  121. 3086Minimum Moves to Pick K OnesWatch
  122. 3090Maximum Length Substring With Two OccurrencesWatch
  123. 3095Shortest Subarray With OR at Least K IWatch
  124. 3097Shortest Subarray With OR at Least K IIWatch
  125. 3134Find the Median of the Uniqueness ArrayWatch
  126. 3135Equalize Strings by Adding or Removing Characters at EndsLocked
  127. 3191Minimum Operations to Make Binary Array Elements Equal to One IWatch
  128. 3206Alternating Groups IWatch
  129. 3208Alternating Groups IIWatch
  130. 3254Find the Power of K-Size Subarrays IWatch
  131. 3255Find the Power of K-Size Subarrays IIWatch
  132. 3258Count Substrings That Satisfy K-Constraint IWatch
  133. 3261Count Substrings That Satisfy K-Constraint IIWatch
  134. 3297Count Substrings That Can Be Rearranged to Contain a String IWatch
  135. 3298Count Substrings That Can Be Rearranged to Contain a String IIWatch
  136. 3305Count of Substrings Containing Every Vowel and K Consonants IWatch
  137. 3306Count of Substrings Containing Every Vowel and K Consonants IIWatch
  138. 3318Find X-Sum of All K-Long Subarrays IWatch
  139. 3321Find X-Sum of All K-Long Subarrays IIWatch
  140. 3323Minimize Connected Groups by Inserting IntervalLocked
  141. 3325Count Substrings With K-Frequency Characters IWatch
  142. 3329Count Substrings With K-Frequency Characters IILocked
  143. 3346Maximum Frequency of an Element After Performing Operations IWatch
  144. 3347Maximum Frequency of an Element After Performing Operations IIWatch
  145. 3364Minimum Positive Sum Subarray Watch
  146. 3411Maximum Subarray With Equal ProductsWatch
  147. 3413Maximum Coins From K Consecutive BagsWatch
  148. 3420Count Non-Decreasing Subarrays After K OperationsWatch
  149. 3422Minimum Operations to Make Subarray Elements EqualLocked
  150. 3439Reschedule Meetings for Maximum Free Time IWatch
  151. 3445Maximum Difference Between Even and Odd Frequency IIWatch
  152. 3505Minimum Operations to Make Elements Within K Subarrays EqualWatch
  153. 3578Count Partitions With Max-Min Difference at Most KWatch
  154. 3589Count Prime-Gap Balanced SubarraysWatch
  155. 3634Minimum Removals to Balance ArrayWatch
  156. 3641Longest Semi-Repeating SubarrayLocked
  157. 3652Best Time to Buy and Sell Stock using StrategyWatch
  158. 3672Sum of Weighted Modes in SubarraysLocked
  159. 3679 Minimum Discards to Balance InventoryWatch
  160. 3694Distinct Points Reachable After Substring RemovalWatch
  161. 3768Minimum Inversion Count in Subarrays of Fixed LengthWatch
  162. 3795Minimum Subarray Length With Distinct Sum At Least KWatch
  163. 3845Maximum Subarray XOR with Bounded RangeWatch
  164. 3851Maximum Requests Without Violating the LimitLocked
  165. 3859Count Subarrays With K Distinct IntegersWatch
  166. 3956Maximum Sum of M Non-Overlapping Subarrays IWatch
  167. 3957Maximum Sum of M Non-Overlapping Subarrays IIWatch
  168. 3969Valid Subarrays With Matching Sum Digits IWatch
  169. 3972Valid Subarrays With Matching Sum Digits IILocked
  170. 4032Longest Subarray With at Most K Distinct Prime FactorsWatch
  171. 4043Count Rotations With Exactly K Equal Adjacent PairsWatch
  172. 4044Count Good Cyclic RotationsWatch