Pregunta de entrevista de Flipkart

A Problem very similar to Rotten Egg problem solved using BFS.