Implementation of problems from leetcode