Pregunta de entrevista de Google

A system design question, Graphs, Stack