You are coding as a Guest. Sign in with your RoleNest account to permanently track your streak, earn XP, and climb the Campus Leaderboard!
Sign In with RoleNestProblem Set
🔥Merge k Sorted Lists: Min-Heap MultiplexerHard
SUPER HARD PROBLEM OF THE DAY+150 XP • FAANG OA TIER
High-difficulty challenge matching authentic Google, Amazon & Uber L5 online assessment conditions.
HardTrees & Graphs•Acceptance: 51.4%
Merge k Sorted Lists: Min-Heap Multiplexer
Targeted in FAANG & Tech OA:AmazonGoogleUber
Real-World Engineering Context
Core to distributed log aggregation systems (Loki, Elasticsearch, Kafka) at Swiggy and Uber, where time-sorted log shards from k microservices are multiplexed in real-time.
You are given an array of `k` sorted integer arrays `lists`. Merge all the sorted arrays into one single sorted array and return it.
Analyze and describe its complexity.
Sample Test Cases
Input: [[[1,4,5],[1,3,4],[2,6]]]
Expected: [1,1,2,3,4,4,5,6]
Input: [[]]
Expected: []
Input: [[[2,3,7]]]
Expected: [2,3,7]
Constraints
- k == lists.length
- 0 <= k <= 10^4
- 0 <= lists[i].length <= 500
- -10^4 <= lists[i][j] <= 10^4
- lists[i] is sorted in ascending order.
- The sum of lists[i].length will not exceed 10^4.
Recruiter Fast-Track ReferralVerified Candidate
Direct pipeline to Google, Amazon, Microsoft, Swiggy, & Uber recruiters
Top DevScore profiles bypass resume screening filters. Every verified problem solve writes authentic proof-of-work to your profile and dispatches you directly into employer inboxes on RoleNest.
Explore 5,000+ Direct ATS Openings on RoleNest ↗✓ Direct Referral Active
Language:
Ready to test. Click Run Code or Submit Solution to run test cases in isolated browser sandbox.