Solved exercise 1 from multidimensional arrays