Given a multi-dimensional array `arr` of arbitrary depth, return a flat, 1-dimensional array containing all elements in order.
You may not use the native `Array.prototype.flat` method.
Example 1:
Input: arr = [1, [2, [3, 4], 5], 6]
Output: [1, 2, 3, 4, 5, 6]
Explanation: All nested brackets are unwrapped into a flat array.