This is my solution to leetcode.