This is my code for leetcode.