AlgoMaster Logo

Merge k Sorted Lists

lists=[[1,4,5],[1,3,4],[2,6]]
0 / 30
input listsmin-heap · size 0L0145L1134L226outthe heap always holds one front node per list; pop the smallest, repeat
algomaster.io
Step:Merge k sorted lists by always taking the smallest available head