revised array from multidimensional to single dimensional and updated solution