> For the complete documentation index, see [llms.txt](https://soumyajit4419.gitbook.io/ds-algo/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://soumyajit4419.gitbook.io/ds-algo/arrays/two-pointer-method.md).

# Two Pointer Method

## &#x20;                                          Two Pointer Method

![Various ways of using two pointer](https://1416717093-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-ME49AWTsL3PV5O3FW36%2F-ME8vLTXE9rXVyJww8nD%2F-ME94wXOOligqRUywLdr%2FArray_Basics_Conclusion_1.png?alt=media\&token=0ed093ec-420b-41cc-b08b-370cc4be917d)

This method is quite helpful in array's to do in-place operations and help us to save an extra space of O(n).

&#x20;**This technique can also be used to solve:**

* `Slow-pointer and fast-pointer problem in Linked List`
* `Sliding Window Problem`

**Iterate the array from two ends to the middle.**\
**One slow-runner and one fast-runner at the same time.**
