Leetcode practice in Python