## Flipkart Interview Question for Software Engineer / Developers

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

i think the Question is .
if situation is like .
110000
111000
100000
100000
111110

then Answer would be the last row and No of 1's are 5 ..

Solution :
Start from the first row .. go till we encounter any zero.
Then step down by one if this new value of second row and same column is also Zero then keep stepping down without increasing Column No. else go in the same Row till find any zero.
You would be with the Row No and No'f of Max 1's at the end.

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

I am unable to understand the question
Can you please provide another example with details

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

Good solution

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

perfect soln

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

good work

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

good thinking mac

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

@mac
You are absolutely right.
they want the same soln.

Only modification is. u can use binary search. i.e check mid one if its 0 go left else right.

complexity with ur soln is 0(n+n) . and they want exactly the same

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

it cannot be done with binary search.. moreover mac's solution can be made to work in O(n)

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

Right solutin......
Thanks..

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

Very good solution mac

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

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

``````#include<stdio.h>
int main()
{
int arr[7][7]={
1,1,0,0,0,0,0,
1,1,1,0,0,0,0,
1,0,0,0,0,0,0,
1,0,0,0,0,0,0,
1,1,1,1,1,0,0,
1,1,1,1,1,1,1,
1,0,0,0,0,0,0
};
int i=0,j=0,flag=0;
while(i<7)
{
while(arr[i][j]==1)
{
j++;
}
printf("j= %d\n",j);
i++;
}
i--;
j--;
printf("i=%d and j=%d",i,j);
return 0;
}``````

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.