A classic whiteboard problem. Example Input: [1, [2, 3, [4, 5], 6]] — Expected Output: [1, 2, 3, 4, 5, 6]