Write a function which takes an array containing either ints or arrays of ints and return a flat array. Input: [1, [2, [ [3, 4], 5], 6]] Output: [1, 2, 3, 4, 5, 6] Method 1: Using inbuilt method “flat” This is the easiest method to flatten the array as “flat” will recurse until the…