Pregunta de entrevista de Booking.com

Classical BFS problem on matrix graph