Merge K Sorted Lists

Merge K Sorted Lists

You are given an array of k linked-lists lists, where each linked-list is sorted in ascending order. Your task is to merge all the linked-lists into a single sorted linked-list and return its head. Example: Input: lists = [[1,4,5],[1,3,4],[2,6]] Output: [1,1,2,3,4,4,5,6] Constraints: k == lists.length 0 <= k <= 10^4 0 <= lists[i].length <= 500 -10^4 <= lists[i][j] <= 10^4 The total number of nodes in all lists does not exceed 10^4.
JavaPriority QueueLinked ListK-Way Merge
00
Read
1
InterviewGPT

AI-powered tools to help you succeed in tech interviews — from resume to offer.

Interview Solver

  • Coding Puzzles
  • System Design
  • Behavioral Challenges
  • ML System Design
  • SQL Puzzles
  • FE System Design
Explore Solver

Question Bank

  • Coding Interview Questions
  • System Design Interview Questions
  • Behavioral Interview Questions
  • ML System Design Questions
  • SQL & Database Questions
  • FE System Design Questions
Explore Questions

Golden Blogs

  • Coding Solutions
  • System Design Guides
  • Behavioral Guides
  • ML System Design Guides
  • SQL Solutions
  • FE System Design Guides
Explore Blogs

Intervipedia

  • Coding Concepts
  • System Design Concepts
  • Behavioral Concepts
  • ML System Concepts
  • SQL Concepts
  • FE System Concepts
Explore Concepts

Application Tools

  • Self-Intro Generator

Company

  • Pricing
  • FAQ
  • About
  • Privacy Policy
  • Terms of Service

© 2026 InterviewGPT Inc. All rights reserved.

All systems operationalUS-East

Made with ♥ for developers