Lazy Union Iterator for Sorted Iterators
Implement a UnionIterator that lazily merges two input iterators, each sorted in non-decreasing order.
The class receives iter1 and iter2 and exposes:
has_next() -> bool
next() -...
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Standard Input
Execution Result:
