Pregunta de entrevista de Amazon

graph question, low level system design.