hacker_rank utopian tree problem