Solution to problems in leetcode