Question
You are given a nested list of integers where each element is either an integer or a (possibly empty) list whose elements are also integers or nested lists. Flatten it and return the integers in the order a depth-first iterator would yield them. Implement it without using recursion at flatten time — simulate the traversal with an explicit stack. The total number of integers is at most 10000 and nesting depth is at most 100. Encode lists as Python lists and integers as Python ints in the input.
flatten_nested(nested: list) → list[int][[1,[4,[6]]]]out[1,4,6]State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.