Data-Core Systems interview question

transform 2d array into array of provided dimension