Leetcode - Two pointers
Two pointer is a fairly common and useful technique for solving leetcode challenges. When several comparisons of pairs in an array are required, this technique tends to be a solid first approach. It boils down to keeping, as the name suggests, two pointers, either one for the first and another for the second element of the array or one for the first and another for the last element of the array.
The main selling point of this technique is that it is much more efficient than looping over arrays in the case where we know we only want to compare forward. It essentially eliminates unnecessary comparisons, which is pretty neat!