Python Problem Solving Leetcode Two