Merge K Sorted Lists

Try to solve the Merge K Sorted Lists problem.


Given an array of kk sorted linked lists, your task is to merge them into a single sorted linked list and return the head of this linked list.


  • k=k = lists.length
  • 0k1030 \leq k \leq 10^3
  • 00 \leq lists[i].length 500\leq 500
  • 103-10^3 \leq lists[i][j] 103\leq 10^3
  • Each lists[i] is sorted in ascending order.
  • The sum of all lists[i].length will not exceed 10310^3.


Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy