Merge K Sorted Lists

Try to solve the Merge K Sorted Lists problem.

Statement

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.

Constraints:

  • k=k = lists.length
  • 0≤k≤1030 \leq k \leq 10^3
  • 0≤0 \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.

Example

Create a free account to view this lesson.

Continue your learning journey with a 14-day free trial.

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