Back to problems

Merge multiple sorted arrays using min-heap

Algorithm · Microsoft · Medium

You are given k integer sequences through arrays, where every sequence arrays[i] is already ordered from smallest to largest, allowing duplicate neighboring values. Let N be the total count of integers across all sequences. Build one new list containing all N integers in ascending order. A technique that checks the first unused value of every sequence once per output element costs too much when k is large. Instead, use a structure that can efficiently identify the minimum…

Checking your access…