## Interview Question

Country: United States

Comment hidden because of low score. Click to expand.
0
of 0 vote

full scan algorithm, O(m*n), where m - number of rows, n - number of columns, all the result values are collected in one loop for m*n iterations.

Comment hidden because of low score. Click to expand.
0
of 0 vote

O(m*n)

``````int[][] n;
int sum = 0; Integer max = null; Integer min = null;

for(int i = 0; i < n.length; i++){
for(int j = 0; j < n[j].length; j++){
sum+=n[i][j];
if(max == null || n[i][j] > max) max = n[i][j];
if(min == null || n[i][j] < min) min = n[i][j];
}
}

System.out.println(min);
System.out.println(max);
System.out.println(sum);``````

Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

### Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

### Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.