Code for leetcode programs