Sankey Solutions interview question

Solve a nested array and make it a normal array