Pregunta de entrevista de Google

Two algorithm questions. One for Topological Sort, another for array implement.