Pregunta de entrevista de Litmus7

Solve the DSA question based on hashing and BFS.