Photo by Christian Stahl on Unsplash

Two Pointers Approach — Python Code

Amit Singh Rathore
Towards Data Science
6 min readApr 17, 2021

--

Two are better than one if they act as one.

Two pointer algorithm is one of the most commonly asked questions in any programming interview. This approach optimizes the runtime by utilizing some order (not necessarily sorting) of the data. This approach is generally used to search pairs in a sorted array. This approach works in constant space.

--

--