0
/ 50
In math, multiplying a matrix by a single number is straightforward. For example, if you had a 2D array of ints
int [][] numbers = { {1,...
In math, multiplying a matrix by a single number is straightforward. For example, if you had a 2D array of ints
int [][] numbers = {
{1, 2, 3},
{4, 5, 6}
};
You could multiply it by 2:
{
{2, 4, 6},
{8, 10, 12}
}
Put simply, each value in the 2D array has been multiplied by 2.
For this method, first create a new array with the same dimensions
as numbers
.
Then set each value in this new array to be the corresponding
value from numbers
multiplied by the given n
.
Finally, return that new array.
Your feedback will appear here when you check your answer.