Driver code Change n at the top to change number of elements in an array
let arr = [ [ 2 , 6 , 12 , 34 ] , [ 1 , 9 , 20 , 1000 ] , [ 23 , 34 , 90 , 2000 ] ] ; let k = arr . length ; let output = new Array ( n * k ) ; mergeKArrays ( arr , 0 , 2 , output ) ; document . write ( " " + " " ) ; printArray ( output , n * k ) ;