Two Pointer Leetcode Problems Python