Two Pointer Algorithm In Python