Adobe Interview Question for Software Engineer / Developers


Country: India
Interview Type: In-Person




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

it cud easily be dun by d use of the two arrays named rows and cols where rows stores the colno of the element vich is max in dat row...while cols stores the row nos of the elemnt that is max in the given col then jst chk if.....col[rows[i]]=i if its true then its the reqd element....
TC-O(n^2)
SC-O(n)

- Anonymous February 29, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

elegant solution

- Punit Jain May 12, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

I think there exists only one saddle point. If all the numbers are distinct!

- Psycho September 26, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

@Anonymous: Your solution does not work. Check this...

If Matrix is

1 4
6 2
5 3

Then

rows = {1,0,0}
cols = {1,0}

and your condition check fails.

- Nitin Gupta October 29, 2012 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

For each row
    Mark the highest element into an index-array.
For each column
    verify the least element in an index-array.
        if already marked. Report the element.
        else continue.

- SantiagoYMG February 29, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

can u give me an example???

- waytogeek January 18, 2013 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

In Two-Game theory, such an element is called a Saddle point. Santiago's answer is standard way to solve it.

- mag March 04, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

int main()
{
int a[4][4] =
{
{10,3,1,12},
{16,2,3,4},
{8,9,20,10},
{5,18,7,11}
};
int rows = 4;
int cols = 4;
int i, j, k,high,id,isPrint = 1;
k = 0;
while(k < rows)
{
high = a[k][0];
isPrint = 1;
id = 0;
for(i = 1; i < cols; i++)
{
if(a[k][i] > high)
{
high = a[k][i];
id = i;
}
}
for(j = 0; j < rows; j++)
{
if(a[j][id] > high)
{
isPrint = 0;
break;
}
}
if(isPrint == 1)
printf("%d\n",high);
k++;

}

return 0;
}

- Anonymous March 29, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

int main()
{
int a[4][4] =
{
{10,3,1,12},
{16,2,3,4},
{8,9,20,10},
{5,18,7,11}
};
int rows = 4;
int cols = 4;
int i, j, k,high,id,isPrint = 1;
k = 0;
while(k < rows)
{
high = a[k][0];
isPrint = 1;
id = 0;
for(i = 1; i < cols; i++)
{
if(a[k][i] > high)
{
high = a[k][i];
id = i;
}
}
for(j = 0; j < rows; j++)
{
if(a[j][id] > high)
{
isPrint = 0;
break;
}
}
if(isPrint == 1)
printf("%d\n",high);
k++;

}

return 0;
}

- Syam devendla March 29, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

are given matrix's rows and columns sorted?

- vips February 29, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

No, Its a general matrix.

- Gaurav February 29, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Give example for this

- sha February 29, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include<iostream>
#include<set>
using namespace std;


void MaxMin(int A[2][2] )
{

set<int> row , col;

for( int i=0 ; i<2 ; i++ )
{
for( int j= 0 ;j<2 ; j++ )
{
        row.insert( A[i][j] );

        for( int k=0 ; k<2 ; k++ )
        {
                col.insert(A[k][j]);
        }
        if( *row.end() == *col.begin() )
                cout << *row.end();



}
}

}


int main()
{

int r[2][2] = {2,2,4,4};
MaxMin(r);

return 0;
}

- Sasi March 09, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote
{{{void FindMatrixElements ( int arr[][COL] , int row , int col){ int max , min , i , j, k,l = 0, maxcol = 0; int ResultArr[SIZE] = {0}; for ( i = 0 ; i < row ; i++){ max = arr[i][0]; for( j = 0 ; j < col ; j++){ if(arr[i][j] > max){ max = arr[i][j]; maxcol = j; } } min = max; {{{ for( k = 0 ; k < col ; k++){ if(arr[k][maxcol] < min ) min = arr[k][maxcol]; }}}} {{{if(max == min){ ResultArr[l] = max; l++; } }}}} {{{ for ( l = 0 ; l < (SIZE); l++){ if(ResultArr[l]!= 0) printf("\n%d",ResultArr[l]); }}}} }}}} - Girija.Aul June 12, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include <iostream>

using namespace std;

int main(){
int i,j, m, n, a[100][100];
cin>>n>>m;
for (i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
cin>>a[i][j];
}
}
for (i=0; i<n; i++)
{
for (j=0;j<m;j++)
{
cout<<a[i][j]<<"\t";
}
cout<<"\n";
}
for(i=n-1, j=0;i>=0&&j<m; i--,j++)
{
cout<<a[i][j]<<"\t";
}
return 0;
}

- Vasundha September 20, 2014 | Flag Reply


Add a Comment
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.

Learn More

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.

Learn More

Resume Review

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.

Learn More

Mock Interviews

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.

Learn More