HackerEarth Karan and Trees Solved