Tap here to switch tabs
Problem
Submissions

Problem: Merge K Sorted Lists

Merge K Sorted Lists combines k singly linked lists, each sorted in ascending order, into one ascending linked list and returns the merged result.

Statement

You are given an array, lists, containing k singly linked lists. Each of these linked lists is individually sorted in ascending order.

Your task is to merge all k linked lists into a single sorted linked list in ascending order and return the merged list.

Constraints:

  • k ==== lists.length

  • 0≤0 \leq k ≤103\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.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Merge K Sorted Lists

Merge K Sorted Lists combines k singly linked lists, each sorted in ascending order, into one ascending linked list and returns the merged result.

Statement

You are given an array, lists, containing k singly linked lists. Each of these linked lists is individually sorted in ascending order.

Your task is to merge all k linked lists into a single sorted linked list in ascending order and return the merged list.

Constraints:

  • k ==== lists.length

  • 0≤0 \leq k ≤103\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.