Amazon interview question

k-way merge