DSAWiser

DSA question set · 150 questions

Sliding Window DSA Practice Questions

Explore 150 DSA questions in Sliding Window. Practice with DSAWiser’s code editor and visualizer.

Sliding WindowMathArraysStringsHash TableSortingTwo PointersPrefix SumQueueGreedyMonotonic QueueDivide and ConquerHeapDynamic ProgrammingBit ManipulationFenwick Tree

What’s in this set

The Sliding Window collection contains 150 problems: 50 basic, 50 easy, 30 medium, 20 hard. Choose a question at your current level, or follow the collection’s order below.

Topics in this collection include Sliding Window, Math, Arrays, Strings, Hash Table. Each question shows its own topics and difficulty so you can decide where to begin.

Practice with the code visualizer

  1. Open a question in the editor and read the statement, inputs, and expected output. Predict the result for a small example before writing code.
  2. Write a solution and run the examples. If a result differs from your prediction, reduce the input until you can follow each step.
  3. Step through your code in the visualizer. Use a breakpoint to inspect the state at a specific line, then compare it with your reasoning.

Questions in this set

150 total

Open a question in the editor to read its statement and examples. Sign in to practice.

  1. Count Total Windows of Size KSliding Window · MathBasic
  2. First Window of Size KSliding Window · ArraysBasic
  3. Last Window of Size KSliding Window · ArraysBasic
  4. All Window Boundary IndicesSliding Window · ArraysBasic
  5. Outgoing and Incoming Elements on SlideSliding Window · ArraysBasic
  6. Single Step Window Sum TransitionSliding Window · MathBasic
  7. Second Window Sum from First WindowSliding Window · ArraysBasic
  8. Sum of Every Adjacent PairSliding Window · ArraysBasic
  9. Sum of Every TripletSliding Window · ArraysBasic
  10. Sum of All Fixed Windows of Size KSliding Window · ArraysBasic
  11. Maximum Sum of Window of Size 2Sliding Window · ArraysBasic
  12. Minimum Sum of Window of Size 2Sliding Window · ArraysBasic
  13. Maximum Sum of Window of Size KSliding Window · ArraysBasic
  14. Minimum Sum of Window of Size KSliding Window · ArraysBasic
  15. Average of Each Window of Size KSliding Window · ArraysBasic
  16. Count Windows with Sum Greater Than TargetSliding Window · ArraysBasic
  17. Count Windows of Size K with Even SumSliding Window · ArraysBasic
  18. Check If Any Window of Size K Sums to TargetSliding Window · ArraysBasic
  19. Count Windows Containing at Least One ZeroSliding Window · ArraysBasic
  20. Count Windows Where All Elements Are PositiveSliding Window · ArraysBasic
  21. All Substrings of Length KSliding Window · StringsBasic
  22. Count Vowels in First Window of Size KSliding Window · StringsBasic
  23. Count Vowels in Every Window of Size KSliding Window · StringsBasic
  24. Maximum Vowels in Any Substring of Length KSliding Window · StringsBasic
  25. Count Windows Starting and Ending with the Same CharacterSliding Window · StringsBasic
  26. Absolute Difference Between Window EndsSliding Window · ArraysBasic
  27. Windows of Size 3 with Strictly Increasing OrderSliding Window · ArraysBasic
  28. Windows of Size 3 Where Middle Element Is PeakSliding Window · ArraysBasic
  29. Maximum Element in Windows of Size 2Sliding Window · ArraysBasic
  30. Range in Windows of Size 2Sliding Window · ArraysBasic
  31. Product of Every Window of Size 2Sliding Window · ArraysBasic
  32. Count Odd Numbers in Each Window of Size KSliding Window · ArraysBasic
  33. Count Windows with Exactly One Negative NumberSliding Window · ArraysBasic
  34. Count Windows of Size 3 with Sum Equal to ZeroSliding Window · ArraysBasic
  35. Alternating Parity Windows of Size 2Sliding Window · ArraysBasic
  36. Compare Sum of First Window and Last WindowSliding Window · ArraysBasic
  37. Largest Difference Between Consecutive Window SumsSliding Window · ArraysBasic
  38. First Window to Reach Target SumSliding Window · ArraysBasic
  39. Index of Window with Maximum SumSliding Window · ArraysBasic
  40. Count Windows Whose Sum Equals TargetSliding Window · ArraysBasic
  41. Count Windows of Size 2 with Identical ElementsSliding Window · ArraysBasic
  42. Count Windows Containing a Specific Target CharacterSliding Window · StringsBasic
  43. Count Windows with at Least Half Even NumbersSliding Window · ArraysBasic
  44. Binary String Windows with All OnesSliding Window · StringsBasic
  45. Number of Zeros in Each Binary WindowSliding Window · ArraysBasic
  46. Sliding Window Step DifferencesSliding Window · ArraysBasic
  47. Count Windows Where First Element Equals Last ElementSliding Window · ArraysBasic
  48. Count Windows of Size 2 with Positive ProductSliding Window · ArraysBasic
  49. First Window with All Elements Greater Than XSliding Window · ArraysBasic
  50. Parity of Each Window SumSliding Window · ArraysBasic
  51. Maximum Average Subarray of Size KSliding Window · ArraysEasy
  52. Minimum Average Subarray of Size KSliding Window · ArraysEasy
  53. Count Windows of Size K with Average at Least ThresholdSliding Window · ArraysEasy
  54. Diet Plan PerformanceSliding Window · ArraysEasy
  55. Minimum Recolors to Get K Consecutive Black BlocksSliding Window · StringsEasy
  56. Substrings of Size Three with Distinct CharactersSliding Window · Strings · Hash TableEasy
  57. Maximum Points You Can Obtain from CardsSliding Window · ArraysEasy
  58. Minimum Swaps to Group All 1's TogetherSliding Window · ArraysEasy
  59. Count Occurrences of AnagramsSliding Window · Strings · Hash TableEasy
  60. Find All Anagram Starting Indices for a 3-Letter PatternSliding Window · Strings · Hash TableEasy
  61. Defuse the Bomb — Forward WindowSliding Window · ArraysEasy
  62. Defuse the Bomb — Backward WindowSliding Window · ArraysEasy
  63. Maximum Circular Subarray Sum of Fixed Size KSliding Window · ArraysEasy
  64. Minimum Swaps to Group All 1's in a Circular Binary ArraySliding Window · ArraysEasy
  65. Consecutive Ones in a Circular Binary Array of Fixed Size KSliding Window · ArraysEasy
  66. Grumpy Bookstore OwnerSliding Window · ArraysEasy
  67. Maximum Span in Windows of Size ThreeSliding Window · ArraysEasy
  68. Maximum Sum of Window with No Adjacent DuplicatesSliding Window · ArraysEasy
  69. Maximum Elements Below Cap in Window of Size KSliding Window · ArraysEasy
  70. Best Fixed Holding Period ProfitSliding Window · ArraysEasy
  71. Count Windows of Size K Divisible by MSliding Window · ArraysEasy
  72. Longest Run of Satisfied Fixed WindowsSliding Window · ArraysEasy
  73. Count Alternating Binary Substrings of Length KSliding Window · StringsEasy
  74. Check If All Windows Have Positive SumSliding Window · ArraysEasy
  75. First Negative Number in Every Window of Size KSliding Window · ArraysEasy
  76. Smallest Subarray with Sum at Least TargetSliding Window · ArraysEasy
  77. Longest Subarray with Sum at Most TargetSliding Window · ArraysEasy
  78. Count Subarrays with Sum Less Than TargetSliding Window · ArraysEasy
  79. Maximum Consecutive Ones with At Most One FlipSliding Window · ArraysEasy
  80. Longest Continuous Segment of OnesSliding Window · ArraysEasy
  81. Subarray Product Less Than KSliding Window · ArraysEasy
  82. Longest Contiguous Segment of Identical ElementsSliding Window · ArraysEasy
  83. Shortest Subsegment Containing Both 0 and 1Sliding Window · ArraysEasy
  84. Longest Subarray of 1's After Deleting One ElementSliding Window · ArraysEasy
  85. Count Subarrays with At Most K Odd NumbersSliding Window · ArraysEasy
  86. Substrings of Length K with at Least Two Distinct VowelsSliding Window · StringsEasy
  87. Longest Homogeneous SubstringSliding Window · StringsEasy
  88. Shortest Subarray Containing M Occurrences of XSliding Window · ArraysEasy
  89. Count Substrings with All Three CharactersSliding Window · Strings · Hash TableEasy
  90. Longest Subarray with Max Difference at Most 1Sliding Window · ArraysEasy
  91. Maximum Sum of Two Non-Overlapping Windows of Size KSliding Window · ArraysEasy
  92. Find K-Beauty of a NumberSliding Window · Math · StringsEasy
  93. Substrings of Length K with Exactly K-1 Distinct CharactersSliding Window · Strings · Hash TableEasy
  94. Frequency of Target Element in Every Window of Size KSliding Window · ArraysEasy
  95. Maximum Score After Splitting a StringSliding Window · StringsEasy
  96. Fruit Into BasketsSliding Window · Arrays · Hash TableEasy
  97. Get Equal Substrings Within BudgetSliding Window · StringsEasy
  98. Max Consecutive Ones IIISliding Window · ArraysEasy
  99. Count Binary Subarrays with At Most K OnesSliding Window · ArraysEasy
  100. Minimum Difference Between Highest and Lowest of K ScoresSliding Window · Arrays · SortingEasy
  101. Longest Substring Without Repeating CharactersSliding Window · Strings · Hash TableMedium
  102. Longest Substring with At Most K Distinct CharactersSliding Window · Strings · Hash TableMedium
  103. Longest Repeating Character ReplacementSliding Window · Strings · Hash TableMedium
  104. Permutation in StringSliding Window · Strings · Hash Table · Two PointersMedium
  105. Find All Anagrams in a StringSliding Window · Strings · Hash TableMedium
  106. Binary Subarrays With SumSliding Window · Arrays · Prefix SumMedium
  107. Count Number of Nice SubarraysSliding Window · Arrays · Prefix SumMedium
  108. Subarrays with K Different IntegersSliding Window · Arrays · Hash TableMedium
  109. Continuous Subarrays with Difference at Most TwoSliding Window · Arrays · QueueMedium
  110. Count Substrings with Exactly K Distinct VowelsSliding Window · Strings · Hash TableMedium
  111. Maximum Erasure ValueSliding Window · Arrays · Hash TableMedium
  112. Maximum Sum of Distinct Subarrays with Length KSliding Window · Arrays · Hash TableMedium
  113. Minimum Operations to Reduce X to ZeroSliding Window · Arrays · Prefix SumMedium
  114. Take K of Each Character From Left and RightSliding Window · Strings · Hash TableMedium
  115. Replace the Substring for Balanced StringSliding Window · Strings · Hash TableMedium
  116. Frequency of the Most Frequent ElementSliding Window · Arrays · SortingMedium
  117. Maximum Beauty of an Array After OperationSliding Window · Arrays · SortingMedium
  118. Maximum Points Covered within Fixed AngleSliding Window · Arrays · MathMedium
  119. Longest Subarray with Absolute Difference At Most LimitSliding Window · Arrays · QueueMedium
  120. Minimum Changes to Make Array ContinuousSliding Window · Arrays · SortingMedium
  121. Longest Semi-Repetitive SubstringSliding Window · StringsMedium
  122. Longest Subarray with At Most Two Occurrences of Each ElementSliding Window · Arrays · Hash TableMedium
  123. Maximum White Tiles Covered by a CarpetSliding Window · Arrays · SortingMedium
  124. Sliding Subarray BeautySliding Window · Arrays · Hash TableMedium
  125. Maximum Free Time After Rescheduling Consecutive MeetingsSliding Window · Arrays · GreedyMedium
  126. Minimum Window Covering All Unique ValuesSliding Window · Arrays · Hash TableMedium
  127. Count Subarrays Where Max Element Appears At Least K TimesSliding Window · ArraysMedium
  128. Smallest Range Covering Elements from All ListsSliding Window · Arrays · Hash TableMedium
  129. Count Complete Subarrays in an ArraySliding Window · Arrays · Hash TableMedium
  130. Length of Longest Subarray With At Most K FrequencySliding Window · Arrays · Hash TableMedium
  131. Minimum Window SubstringSliding Window · Strings · Hash TableHard
  132. Sliding Window MaximumSliding Window · Arrays · Queue · Monotonic QueueHard
  133. Substring with Concatenation of All WordsSliding Window · Strings · Hash TableHard
  134. Longest Substring with At Least K Repeating CharactersSliding Window · Strings · Divide and ConquerHard
  135. Sliding Window MedianSliding Window · Arrays · HeapHard
  136. Shortest Subarray with Sum at Least KSliding Window · Arrays · Queue · Monotonic QueueHard
  137. Maximum Number of Robots Within BudgetSliding Window · Arrays · Queue · Monotonic QueueHard
  138. Constrained Subsequence SumSliding Window · Arrays · Dynamic Programming · QueueHard
  139. Maximum Sum of Three Non-Overlapping SubarraysSliding Window · Arrays · Dynamic ProgrammingHard
  140. Minimum Window SubsequenceSliding Window · Strings · Dynamic Programming · Two PointersHard
  141. Shortest Subarray with Bitwise OR at Least KSliding Window · Arrays · Bit ManipulationHard
  142. Maximum Fruits Harvested After at Most K StepsSliding Window · Arrays · Prefix SumHard
  143. Count Subarrays With Fixed BoundsSliding Window · Arrays · QueueHard
  144. Count Unique Characters of All SubstringsSliding Window · Strings · Hash TableHard
  145. Shortest Subarray with at Least K InversionsSliding Window · Arrays · Fenwick TreeHard
  146. Max Value of Equation with Sliding Coordinate WindowSliding Window · Arrays · Queue · Monotonic QueueHard
  147. Longest Substring Where All Present Characters Have Equal FrequencySliding Window · Strings · Hash TableHard
  148. Minimum Cost to Make Elements in Window of Size K EqualSliding Window · Arrays · HeapHard
  149. Shortest Subarray with Bitwise AND At Most KSliding Window · Arrays · Bit ManipulationHard
  150. Maximum Frequency in Every Window of Size KSliding Window · Arrays · Hash TableHard