I noticed simple approach is to just flatten entire list first in constructor, since this makes next and hasNext O(1), even though constructor is O(N). Would an interviewer be ok with this approach, or would he want to actually dynamically maintain some kind of stack so that it always has the next integer?
Definitely no. An iterator should never copy the input data structure.
see my post for a comparison between different approaches.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.