Two Pointer Algorithm Python Template String