Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Merge K Sorted Lists

MediumPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Merge K Sorted Lists. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Merge k Sorted Lists

Asked in the Coding stage. LeetCode 23.

Task

Implement merge_k_lists(lists). Each input list is sorted in nondecreasing order. Return one sorted list containing every value from every input list. Lists are represented as Python arrays for grading; an empty list represents an empty linked list.

Constraints

  • 0 <= len(lists) <= 100
  • The total number of values across all lists is at most 500
  • Each input list is sorted in nondecreasing order
  • Values are integers

Function Signature

def merge_k_lists(lists):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output