Pergunta de entrevista da empresa Amazon

Graph related question and stack.