Two Pointer Algorithm Time Complexity