You are given a 1D array of integers, such as........
Software QA/Tests Interview Questions from Microsoft
(Continued from previous question...)
You are given a 1D array of integers, such as........
Q:
Microsoft Interview Question for SDE in tests about Algorithm
You are given a 1D array of integers, such as:
int[] array = [3,4,7,2,2,6,0,9];
Suppose you need to treat this array as a 2D table with a given number of rows.
You want to sum the columns of the table.
another value for numRows is 4..in that case the resultant array would look like
what if numRows==4?
3 4
7 2
2 6
0 9
----
12 21
write up a function as follows:
int[] retArray SumColumns(int[] array, int numRows)
{
}
try to come up with a linear solution- no constraints on space..
(Continued on next question...)
Other Interview Questions
|