Algorithms and Data Structures · Middle · Question 17 of 75

What is the sliding window technique?

Explanation

Instead of recomputing every subarray from scratch, the window adds the new element on the right and removes the old one on the left. Problems like "longest substring without repeating characters" become O(n).

Further reading

Problem with a question

Algorithms and Data Structures · Middle · question 17

Test yourself

Take the Algorithms and Data Structures · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz