Search
⌘K

Leetcode 281. Zigzag Iterator

Implement an iterator that returns elements from multiple input lists in round-robin (zigzag) order, preserving the order within each list and skipping lists that become exhausted. The challenge is to design next() and hasNext() to alternate across lists efficiently even when lengths differ (e.g., via index/iterator rotation).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.