LeetCode solutions in Python 2