Qualcomm Interview Question for Software Engineer / Developers






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

int m[r][c];
 int i,j;
 for(i=0;i<r;++i) 
   if(i&1) // even lines
      for(j=c-1;j>=0;j--) cout<<m[i][j];
   else
      for(j=0;j<c;++j) cout<<m[i][j];

- Anonymous October 29, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

what do you mean by snake like order here?It will be great if you can explain the question.

- sourabh February 14, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

4 5 6 7 7 3 4 6 --
4 1 6 3 1 3 4 6 --
3 9 3 7 8 4 3 7 --
2 5 6 1 9 3 1 6 --
4 7 4 8 3 9 4 5 --
7 6 6 7 2 3 6 2 --
8 5 5 7 1 3 4 2 --
4 5 6 7 1 3 4 6 -

So Printing in snake would mean get these values from the 8x8 array:
4,5,1,6,3,7,1,9,3,9,3,6,4,2,6 ; get this along the diagonals

- Des April 14, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include<iostream>
using namespace std;
int main()
{
int a[4][6]={{1,2,3,5,6},{7,8,9,1,2,3},{4,5,6,7,8,9},{1,2,3,4,5,6}},i,j,c;
for(i=0;i<4;i++)
{
for(j=i,c=0;c<2;c++,j++)
{
cout<<a[i][j];
}
}
return 0;
}

- Anonymous April 02, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Recursive Solution

private static void printSnake(int[][] array,int row,int col){
		if(array.length == row || array[0].length == col)
			return;
		
		System.out.print(array[row][col] + " ");
		if(col + 1 == array[0].length)
			return;
		else
			System.out.println(array[row][col+1]);
		printSnake(array,row+1,col+1);
	}

- Anonymous June 16, 2011 | 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