
Flatten a nested array of integers into a single list without using .flat(). The output must preserve the original left-to-right order, and the nesting depth may be arbitrary.
[1, [2, 3], [4, [5]], 6]Output[1, 2, 3, 4, 5, 6]WhyNested arrays are expanded recursively in order.[[], [[1]], 2]Output[1, 2]WhyEmpty arrays contribute nothing.`1 <= len(arr) <= 10^4`Elements are integers or nested arraysPreserve left-to-right orderDepth may be large