← 返回 coinbase 的题目列表Interleaved List of Lists
类型:online_judge
coinbase
Given a list of lists of integers, return an interleaved list of integers. For example, given input [[1, 2, 3], [4, 5], [6]], the output should be [1, 4, 6, 2, 5, 3].
Follow-up 1: Write two iterator classes, each implementing hasNext() and getNext(). The first iterator class takes a list of integers and returns them in order. The second iterator class takes startInt, endInt, and step to enumerate integers.
Follow-up 2: Utilize the iterators from the previous follow-up to accomplish the main problem with a list of iterators as input.
Write a complete program and run custom tests.
Example Test Case
Input: [[1, 2, 3], [4, 5], [6]]
Output: [1, 4, 6, 2, 5, 3]
Example
Input
[[1,2,3], [4,5], [6]]