Glossary: Coding Interviews in C++
Two pointers
Also written: two-pointer
Keeping two indexes, `left` at the front and `right` at the back of a sorted vector, and moving one inward each step. It finds pairs in O(n) time and O(1) space.
Glossary: Coding Interviews in C++
Also written: two-pointer
Keeping two indexes, `left` at the front and `right` at the back of a sorted vector, and moving one inward each step. It finds pairs in O(n) time and O(1) space.