Sliding Window DSA Problems

146 sliding window problems for coding interviews and campus placements, with hints and company tags. Below are the first 100 of 146: 19 easy, 44 medium and 37 hard. Practise them free on InternHack and track what you have solved.

Sliding Window problems, easiest first

  1. Alternating Groups I (Easy)
  2. Contains Duplicate II (Easy)
  3. Count Substrings That Satisfy K-Constraint I (Easy)
  4. Defuse the Bomb (Easy)
  5. Diet Plan Performance (Easy)
  6. Find the K-Beauty of a Number (Easy)
  7. Find X-Sum of All K-Long Subarrays I (Easy)
  8. Longest Even Odd Subarray With Threshold (Easy)
  9. Longest Harmonious Subsequence (Easy)
  10. Longest Nice Substring (Easy)
  11. Maximum Average Subarray I (Easy)
  12. Maximum Length Substring With Two Occurrences (Easy)
  13. Maximum Strong Pair XOR I (Easy)
  14. Maximum Subarray With Equal Products (Easy)
  15. Minimum Difference Between Highest and Lowest of K Scores (Easy)
  16. Minimum Positive Sum Subarray (Easy)
  17. Minimum Recolors to Get K Consecutive Black Blocks (Easy)
  18. Shortest Subarray With OR at Least K I (Easy)
  19. Substrings of Size Three with Distinct Characters (Easy)
  20. Alternating Groups II (Medium)
  21. Arithmetic Slices (Medium)
  22. Best Time to Buy and Sell Stock using Strategy (Medium)
  23. Binary String With Substrings Representing 1 To N (Medium)
  24. Binary Subarrays With Sum (Medium)
  25. Continuous Subarrays (Medium)
  26. Count Complete Subarrays in an Array (Medium)
  27. Count Number of Nice Subarrays (Medium)
  28. Count of Substrings Containing Every Vowel and K Consonants II (Medium)
  29. Count Partitions With Max-Min Difference at Most K (Medium)
  30. Count Prime-Gap Balanced Subarrays (Medium)
  31. Count Subarrays Where Max Element Appears at Least K Times (Medium)
  32. Count Substrings That Can Be Rearranged to Contain a String I (Medium)
  33. Count Substrings With K-Frequency Characters I (Medium)
  34. Count Substrings Without Repeating Character (Medium)
  35. Count the Number of Good Subarrays (Medium)
  36. Count Zero Request Servers (Medium)
  37. Distinct Numbers in Each Subarray (Medium)
  38. Equalize Strings by Adding or Removing Characters at Ends (Medium)
  39. Find All Anagrams in a String (Medium)
  40. Find K Closest Elements (Medium)
  41. Find K-Length Substrings With No Repeated Characters (Medium)
  42. Find Longest Special Substring That Occurs Thrice I (Medium)
  43. Find Longest Special Substring That Occurs Thrice II (Medium)
  44. Find Pattern in Infinite Stream I (Medium)
  45. Find the Longest Equal Subarray (Medium)
  46. Find the Power of K-Size Subarrays I (Medium)
  47. Find Two Non-overlapping Sub-arrays Each With Target Sum (Medium)
  48. Frequency of the Most Frequent Element (Medium)
  49. Fruit Into Baskets (Medium)
  50. Get Equal Substrings Within Budget (Medium)
  51. Grumpy Bookstore Owner (Medium)
  52. Jump Game VII (Medium)
  53. K Radius Subarray Averages (Medium)
  54. Kth Smallest Subarray Sum (Medium)
  55. Length of Longest Subarray With at Most K Frequency (Medium)
  56. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit (Medium)
  57. Longest Nice Subarray (Medium)
  58. Longest Repeating Character Replacement (Medium)
  59. Longest Subarray of 1's After Deleting One Element (Medium)
  60. Longest Substring Of All Vowels in Order (Medium)
  61. Longest Substring with At Least K Repeating Characters (Medium)
  62. Longest Substring with At Most K Distinct Characters (Medium)
  63. Longest Substring Without Repeating Characters (Medium)
  64. Apply Operations to Maximize Frequency Score (Hard)
  65. Constrained Subsequence Sum (Hard)
  66. Contains Duplicate III (Hard)
  67. Count Complete Substrings (Hard)
  68. Count Non-Decreasing Subarrays After K Operations (Hard)
  69. Count Subarrays With Fixed Bounds (Hard)
  70. Count Subarrays With Score Less Than K (Hard)
  71. Divide an Array Into Subarrays With Minimum Cost II (Hard)
  72. Find Pattern in Infinite Stream II (Hard)
  73. Find Substring With Given Hash Value (Hard)
  74. Find the Median of the Uniqueness Array (Hard)
  75. Find X-Sum of All K-Long Subarrays II (Hard)
  76. K Empty Slots (Hard)
  77. Length of the Longest Valid Substring (Hard)
  78. Longest Duplicate Substring (Hard)
  79. Max Value of Equation (Hard)
  80. Maximize the Minimum Powered City (Hard)
  81. Maximum Difference Between Even and Odd Frequency II (Hard)
  82. Maximum Frequency of an Element After Performing Operations II (Hard)
  83. Maximum Frequency Score of a Subarray (Hard)
  84. Maximum Fruits Harvested After at Most K Steps (Hard)
  85. Maximum Number of Robots Within Budget (Hard)
  86. Maximum Number of Visible Points (Hard)
  87. Maximum Strong Pair XOR II (Hard)
  88. Maximum Sum of 3 Non-Overlapping Subarrays (Hard)
  89. Minimum Adjacent Swaps for K Consecutive Ones (Hard)
  90. Minimum Moves to Pick K Ones (Hard)
  91. Minimum Number of K Consecutive Bit Flips (Hard)
  92. Minimum Number of Operations to Make Array Continuous (Hard)
  93. Minimum Window Subsequence (Hard)
  94. Minimum Window Substring (Hard)
  95. Shortest Subarray with Sum at Least K (Hard)
  96. Sliding Window Maximum (Hard)
  97. Sliding Window Median (Hard)
  98. Smallest Range Covering Elements from K Lists (Hard)
  99. Subarrays with K Different Integers (Hard)
  100. Substring with Concatenation of All Words (Hard)

Companies that ask sliding window problems

Before your interview

Most resumes are filtered by software before a recruiter reads them. Check your resume ATS score free, no signup needed.

Other DSA topics