DIY: Flatten Nested List Iterator
Explore how to build a NestedIterator class that efficiently flattens nested lists of integers. Understand implementing constructor, next, and hasNext methods to sequentially access all integers as a flat list.
We'll cover the following...
We'll cover the following...
Problem statement
You will be given a nested list of integers named nestedList. Each element will either be an integer or a list whose elements may also be integers or other lists. Your task will be to implement an iterator to flatten the nested list.
You will have to implement the nestedIterator class. This class has ...