AJGoley
BAN USER
Comments (3)
Reputation 0
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
void set(int row, int col, int val) {
return matrix[row][col] = val;
}
int sum(int row, int col){
int res = 0;
for(int r = 0; r <= row; r++){
if(r==row){
for(int c = 0; c <= col; c++){
res += matrix[r][c];
}
} else {
for(int c = 0; c <= matrix[r].length; c++){
res += matrix[r][c];
}
}
}
return res;
}
sorry for the bad format above.
- AJGoley September 01, 2016Comment hidden because of low score. Click to expand.
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
recursive answer O(n^2)
- AJGoley September 26, 2016