Comments (1)

Reputation -5

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

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.

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Algorithm:

- amit May 04, 2014Let the given binary matrix be M[R][C]. The idea of the algorithm is to construct an auxiliary size matrix S[][] in which each entry S[i][j] represents size of the square sub-matrix with all 1s including M[i][j] where M[i][j] is the rightmost and bottommost entry in sub-matrix.

1) Construct a sum matrix S[R][C] for the given M[R][C].

a) Copy first row and first columns as it is from M[][] to S[][]

b) For other entries, use following expressions to construct S[][]

If M[i][j] is 1 then

S[i][j] = min(S[i][j-1], S[i-1][j], S[i-1][j-1]) + 1

Else /*If M[i][j] is 0*/

S[i][j] = 0

2) Find the maximum entry in S[R][C]

3) Using the value and coordinates of maximum entry in S[i], print

sub-matrix of M[][]

Algorithm mentioned in this link can be applied - >

geeksforgeeks.org/maximum-size-sub-matrix-with-all-1s-in-a-binary-matrix/