https://www.hackerrank.com/challenges/utopian-tree