PRACTICE / UNDERSTAND / REPEAT

Data Structures & Algorithms: Sliding windows

Practice sliding windows with self-contained questions. Check your answer, then use the explanation to understand the reasoning.

20 questionsAnswers explainedFree · no login
Question 1 of 20
Sliding windows · MCQQuestion link ↗

An array contains 5 elements. How many contiguous windows of length 3 does it have?

Choose one answer
Answer & explanation

Answer: 3

A window of size k in an array of length L has L - k + 1 valid starting positions.