A python version solution for leetcode questions.