Question DSA-HEAP-0043
MediumWhat is the output of this code?
import heapq
lists = [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
print(list(heapq.merge(*lists))[3:6])
- A.
[4, 7, 2]
- B.
[4, 5, 6]
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Heaps and Priority Queues question
What is the output of this code?
import heapq
lists = [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
print(list(heapq.merge(*lists))[3:6])
[4, 7, 2]
[4, 5, 6]
Sign up free to see the answer and a step-by-step explanation.
[3, 4, 5]
[2, 5, 8]