Two Pointers

5 problems using this pattern

About this pattern:

Use two pointers moving towards each other or in the same direction to solve in O(n) time.

Complexity Range

Time Complexity

O(log n) (1 problem)
O(n) (4 problems)

Space Complexity

O(1) (5 problems)

Problems Using Two Pointers

← Back to All Patterns