Pergunta de entrevista da empresa HARMAN

Merge and sort the 2D array in topological order