"content":"<p>Given a <strong>multi-dimensional array</strong> of integers, return a generator object which yields integers in the same order as <strong>inorder traversal</strong>.</p>\n\n<p>A <strong>multi-dimensional array</strong> is a recursive data structure that contains both integers and other <strong>multi-dimensional arrays</strong>.</p>\n\n<p><strong>inorder traversal</strong> iterates over each array from left to right, yielding any integers it encounters or applying <strong>inorder traversal</strong> to any arrays it encounters.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> arr = [[[6]],[1,3],[]]\n<strong>Output:</strong> [6,1,3]\n<strong>Explanation:</strong>\nconst generator = inorderTraversal(arr);\ngenerator.next().value; // 6\ngenerator.next().value; // 1\ngenerator.next().value; // 3\ngenerator.next().done; // true\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> arr = []\n<strong>Output:</strong> []\n<strong>Explanation:</strong> There are no integers so the generator doesn't yield anything.\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>0 <= arr.flat().length <= 10<sup>5</sup></code></li>\n\t<li><code>0 <= arr.flat()[i] <= 10<sup>5</sup></code></li>\n\t<li><code>maxNestingDepth <= 10<sup>5</sup></code></li>\n</ul>\n\n<p> </p>\n<strong>Can you solve this without creating a new flattened version of the array?</strong>",
"envInfo":"{\"javascript\": [\"JavaScript\", \"<p><code>Node.js 16.13.2</code>.</p>\\r\\n\\r\\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\\\"http://node.green/\\\" target=\\\"_blank\\\">new ES6 features</a>.</p>\\r\\n\\r\\n<p><a href=\\\"https://lodash.com\\\" target=\\\"_blank\\\">lodash.js</a> library is included by default.</p>\\r\\n\\r\\n<p>For Priority Queue / Queue data structures, you may use 5.3.0 version of <a href=\\\"https://github.com/datastructures-js/priority-queue/tree/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\">datastructures-js/priority-queue</a> and 4.2.1 version of <a href=\\\"https://github.com/datastructures-js/queue/tree/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\">datastructures-js/queue</a>.</p>\"], \"typescript\": [\"Typescript\", \"<p><code>TypeScript 5.1.6, Node.js 16.13.2</code>.</p>\\r\\n\\r\\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\\\"http://node.green/\\\" target=\\\"_blank\\\">new ES2022 features</a>.</p>\\r\\n\\r\\n<p><a href=\\\"https://lodash.com\\\" target=\\\"_blank\\\">lodash.js</a> library is included by default.</p>\"]}",