
Flatten a deeply nested array whose elements are either JSON objects (dict) or more arrays. Return all objects in left-to-right order without using recursion.
[{"id": 1}, [{"id": 2}, [{"id": 3}]], {"id": 4}]Output[{"id": 1}, {"id": 2}, {"id": 3}, {"id": 4}]WhyNested arrays are expanded while preserving order.[[[{"name": "a"}]], [], [{"name": "b"}, [{"name": "c"}]]]Output[{"name": "a"}, {"name": "b"}, {"name": "c"}]WhyEmpty arrays are ignored.`0 <= total elements across nesting <= 10^5`Each element is either a `dict` or a `list`Nesting depth can be very large