← Sliding Window Quiz: all 8 questions
Sliding Window Quiz · Question 5 of 8
In the variable-window template for a LONGEST valid window, when do you update the answer?
In the variable-window template for a LONGEST valid window, when do you update the answer?
- A.Before expanding the window
- B.Inside the shrinking loop
- C.After shrinking, once the window is valid again
- D.Only at the very end
Answer & explanation
Correct answer: After shrinking, once the window is valid again
Expand right, shrink while invalid, then the window is valid — that's when it's a candidate for the longest.
Can you get the rest right without peeking?
Take the timed Sliding Window Quiz quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →