Algorithms and Data Structures

Lesson 03 · 15 min

Two pointers and sliding window

Two techniques that turn checking every pair into a single pass.

15 minLesson 3 of 8Practice includedAsk AI on any point

Many problems on arrays and strings are solved with two indices moving over the data. Instead of a nested loop at O(n²) you get one pass at O(n) with O(1) memory.

Sign in to continue

The rest of this lesson opens after sign up

The first lesson of every course is open without an account. To read on, solve the practice and use Ask, create a free account or log in.