Utopian Tree

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