design
hasNext()
next()
can be called independentlyfor safety, call hasNext() before next()
cant store all data in advance
https://leetcode.com/problems/binary-search-tree-iterator https://leetcode.com/problems/flatten-nested-list-iterator https://leetcode.com/problems/peeking-iterator https://leetcode.com/problems/zigzag-iterator https://leetcode.com/problems/flatten-2d-vector https://leetcode.com/problems/design-compressed-string-iterator
Last updated