Google Interview Question
Software Engineer / DevelopersCountry: India
Consider the intersection element.
Min (Max elements of row) >= the intersection element >= Max(Min of columns).
Let us assume "min(max of rows) ==> minR is less than max(min of columns) ==>MaxC" --- (1),
Now let MaxC is from the jth column of matrix A and MinC is from the ith row of matrix A. Then all the elements along column j must be > MaxC which implies A[i][j] > MaxC and from (1) we know MaxC > minR ==> A[i][j] > minR, which is not possible. this contradicts our supposition.
Hence minR is not less than maxC.
True.Consider an array sorted by rows and columns. Min entries of columns would occur in the first row. The maximum of these values would be (0,matrix[0].length-1). However, this value would also be the smallest entries across the maximum entries in each row (these entries would occur in column mat.length-1).
A: min(max of rows)
B: max(min of columns)
X>=B, since B is min of the column
- RedMouse August 01, 2012A>=X, since A is max of the row
Therefore, A >=X>=B ==> A>=B