created solution fro utopian tree

Question can be get here 
https://www.hackerrank.com/challenges/utopian-tree