🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Sliding Window Quiz: questions with answers

8 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. Which questions are typical sliding-window problems? (select all that apply)
  2. Q2. A fixed window of size k slides one step right. How is the new sum computed in O(1)?
  3. Q3. What is the maximum sum of 3 consecutive elements in [2, 1, 5, 1, 3, 2]?
  4. Q4. What is the length of the longest substring without repeating characters in "abcabcbb"?
  5. Q5. In the variable-window template for a LONGEST valid window, when do you update the answer?
  6. Q6. What is the time complexity of the variable sliding window, even with the inner while loop?
  7. Q7. Why does a sum-based sliding window fail when the array contains negative numbers?
  8. Q8. What is the length of the shortest subarray of [2, 3, 1, 2, 4, 3] with sum ≥ 7?