Zipped Iterator
Implement a zip iterator of two lists of integers a and b where
next()polls the next element in the iterator, alternating betweenaandbhasnext()which returns whether the next element exists
Constraints
n ≤ 100,000wherenis the number of calls tonextandhasnext
https://binarysearch.com/problems/Zipped-Iterator
Examples
Example 1
Input
- methods =
['constructor', 'hasnext', 'next', 'next', 'next', 'next', 'next', 'hasnext'] - arguments =
[[[1, 2], [3, 4, 5]], [], [], [], [], [], [], []]
Output
- answer =
[None, True, 1, 3, 2, 4, 5, False]
Leave a comment