Hacker Rank - Even tree