HARMAN Interview Question

Merge and sort the 2D array in topological order