Solution for The Witches of Hegwarts

http://www.hackerearth.com/druva-hiring-challenge/algorithm/the-witches-of-hegwarts-1/