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