solution to LeetCode problems in Python