<p>Given a <strong>multi-dimensional</strong> array <code>arr</code> and a depth <code>n</code>, return a <strong>flattened</strong> version of that array.</p>
<p>A <strong>multi-dimensional</strong> array is a recursive data structure that contains integers or other <strong>multi-dimensional</strong> arrays.</p>
<p>A <strong>flattened</strong> array is a version of that array with some or all of the sub-arrays removed and replaced with the actual elements in that sub-array. This flattening operation should only be done if the current depth of nesting is less than <code>n</code>. The depth of the elements in the first array are considered to be <code>0</code>.</p>
Passing a depth of n=0 will always result in the original array. This is because the smallest possible depth of a subarray (0) is not less than n=0. Thus, no subarray should be flattened. </pre>
The subarrays starting with 4, 7, and 13 are all flattened. This is because their depth of 0 is less than 1. However [9, 10, 11] remains unflattened because its depth is 1.</pre>