0 votes
9 views
by
When to use a 2 pointer?

1 Answer

0 votes
by
The two-pointer technique is a pattern where two pointers iterate over the data structure in tandem or separately until they satisfy a certain condition. This pattern is extremely useful when dealing with linear data structures such as arrays, linked lists, or strings.
...