Project Euler Solutions Hackerrank Javascript