Qualcomm Interview Question Software Engineer / Developers




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

http://en.wikipedia.org/wiki/In-place_matrix_transposition

#define DIM_MATRIX 10
int m[DIM_MATRIX][DIM_MATRIX];

// void Transpose(int dim, int m[][]) // error C2087: 'm' : missing subscript
// void Transpose(int dim, int (*m)[]) // error C2036: 'int (*)[]' : unknown size
void Transpose(int dim, int *m)
{
for (int row = 1; row<dim; row++)
{
for (int col=0; col<row; col++)
{
int t = m[col*dim+row];
m[col*dim+row] = m[row*dim+col];
m[row*dim+col] = t;
}
}
}

- kichi on September 20, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

void transposeMatrix(int **myArray, int N){
for(int i=0,j=0; i < N; i++){
for(j = i + 1;j<N;j++){
myArray[i][j] = myArray[i][j] ^ myArray[j][i];
myArray[j][i] = myArray[i][j] ^ myArray[j][i];
myArray[i][j] = myArray[i][j] ^ myArray[j][i];
}
}
}

- Anonymous on October 11, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

not correct

- Anonymous on January 06, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include <stdio.h>

int main(int argc, char *argv[])
{
int a[4][4] = {{1,2,3,4}, {5,6,7,8}, {9,10,11,12}, {13, 14, 15, 16}};
int i, j, temp;
int dim = 4;

for (i=0; i<dim-1; i++)
{
for (j=i; j<dim; j++)
{
temp = a[i][j];
a[i][j] = a[j][i];
a[j][i] = temp;
}
}

for (i=0; i<dim; i++)
{
for (j=0; j<dim; j++)
{
printf("%d", a[i][j]);
}
printf("\n");
}
return 0;
}

- Anonymous on October 16, 2009 | Flag Reply


Add a Comment
Name:

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

Books

is a comprehensive book walking you through 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