Solution to the problems given in the Leetcode