Complete the sumArray method so that it does the following:
Given two 2D arrays of different sizes, create a new rectangular 2D array with a size large enough to encompass all elements of both arrays. The elements of the new 2D array should be equal to the sum of the two given arrays in the applicable indexes.
Example:
int[][] a = {
{1,0},
{1,1},
{1,0}
};
int[][] b = {
{1,1,0,1},
{1,1,1,1}
};
sum of the two arrays a and b will return
{
{2,1,0,1},
{2,2,1,1},
{1,0,0,0}
}
top of page
To see this working, head to your live site.
2-D Array Exercises
2-D Array Exercises
0 comments
Like
Comments
bottom of page