Pregunta de entrevista de Walmart Global Tech

coding question was on graph and 2d matrix