Jul-06-2022, 11:27 AM
I think the challenge in the question is that N and M are used in 2 different ways. The question states the matrix is NxM, then you get passed in to the function N and M but they are different - the example is 3x3 then 2x2.
So, to re-format the question (I hope correctly!):
Write a function that accepts a 2D array and two integers, Row and Cols. Function should then return the subset of the array that is the upper left corner, size Row x Cols.
That actually works out to be _relatively_ easy.
Good luck.
So, to re-format the question (I hope correctly!):
Write a function that accepts a 2D array and two integers, Row and Cols. Function should then return the subset of the array that is the upper left corner, size Row x Cols.
That actually works out to be _relatively_ easy.
Good luck.