Zigzag Iterator
Given two 1d vectors, implement an iterator to return their elements alternately.
Example:
Follow up: What if you are givenk
1d vectors? How well can your code be extended to such cases?
Clarification for the follow up question:
The "Zigzag" order is not clearly defined and is ambiguous fork > 2
cases. If "Zigzag" does not look right to you, replace "Zigzag" with "Cyclic". For example:
Solution
Last updated