The course material spends a lot of time specifying this works when you have only TWO elements of the input data - " * We are only considering the two elements in the input data that are pointed to by the two pointers rather than the whole set of elements located between the two pointers."
How do 3 elements, and not 2 elements, play into it?
Course: Grokking Coding Interview Patterns in Java - Learn Interactively
Lesson: Two Pointers: Introduction - Grokking Coding Interview Patterns in Java