Codechef And Leetcode Javascript Solution