Twin Health interview question

Merge k sorted Array lists

Interview Answer

Anonymous

3 Aug 2022

I solved it using priority queue. Added all the elements from list to minHeap priority queue and then added them one by one to the result list. For this the Runtime : O(n*mlog(n*m)) and Space complexity : O(n*m). Expected Runtime : O(n Log k)