Code for leetcode problems