The following approach is effective when you need to determine elements that sum up to a particular value in a sorted array.
 
![[twop.excalidraw|200%]]
 
The crux is:
 
$$
Increase \space left \space pointer \to Sum \space Increases
$$
$$
Decrease \space right \space pointer \to Sum \space Decreases
$$
 
Also for quite a lot of problems the two primary ways of applying two pointers is:
- Widest Coverage
$$
left=0\space,\space right=array.size() - 1 \space \{left < right;\space left++,\space right--\}
$$
- Slow Pointer, Fast Pointer (`k` is step size for the fast pointer)
$$
left=0\space,\space right=0 \space \{right < array.size();\space left++,\space right += k\}
$$