So I posted here a few days ago about having trouble with matrixes. My exam is going to focus heavily on matrixes and manipulation of them. One thing i'm particularly hitting a wall with is making sure I don't get out of bound errors when traversing a matrix. I know how to access the rows and columns of a matrix, but when needing to traverse a matrix in an unfamiliar order I get lost. One assignment wants me to traverse a matrix diagonally. Here is an example of a question that may be similar to what I am asked.
Given a two-dimensional array arr with dimensions MxN (M and N are not necessarily the same), you are
asked to write a method called flatten that will create and return a one-dimensional array based on arr
using the following scheme: only positive values from arr are kept and they are stored in the new one-
dimensional array sequentially, row-by-row. For example, with the following 3x4 array as input your method
should return the one-dimensional array also shown below. The original array should obviously remain intact.