Leetcode problems and their solutions using javascript