Internet Brands Interview Question

Hackerrank challenge