Glossary: Algorithms Beyond the Basics in Go
Two pointers
Also written: two-pointer
Two indexes into one slice. Walking from both ends of a sorted slice finds a pair in O(n) with O(1) memory.
Glossary: Algorithms Beyond the Basics in Go
Also written: two-pointer
Two indexes into one slice. Walking from both ends of a sorted slice finds a pair in O(n) with O(1) memory.