Leetcode Coding Exercise For Python