Qualcomm Interview Question for Software Engineer / Developers






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

Here is the code...

#include<stdio.h>
void combinations(int * result, int start, int prev);
const char * getcode(int digit);
void main()
{
	int result[7];
	for(int i = 0; i < 9; i++)
	{
		result[0] = i;
		combinations(result, 1 ,i);
	}
}
void combinations(int * result, int start, int prev)
{
	const char *code;
	int i,k=0;
	if(start == 7)
	{
		printf("\nCombination: ");
		for(i=0;i<7;i++)
			printf("%d ", result[i]);		
		return;
	}
	code = getcode(prev);
	k=0;
	while(code[k] != '\0')
	{
		result[start] = code[k++] - '0';
		combinations(result, start+1, result[start]);			
	}	
}
const char * getcode(int digit)
{
	char *code;
	switch(digit)
	{
		case 0: code = "46";
					break;
		case 1: code = "68";
					break;
		case 2: code = "79";
					break;
		case 3: code = "48";
					break;
		case 4: code = "39";
					break;
		case 5: code = "5";
					break;
		case 6: code = "17";
					break;
		case 7: code = "26";
					break;
		case 8: code = "13";
					break;
		case 9: code = "24";
					break;
	}
	return code;
}

- gauravk.18 February 29, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Hi gauravk.18,
Seems that you've almost done, but missed the repetition clause in the given problem.

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

Linkan Chen: lkchen1128@gmail.com
If the code have problem, hope you can contact me.

vector<string> StringArray;

CreateTeleNum(vector<string> NumArray, char[] A, string StringNum,int i, int j, int level){
if(level==0){
for(int i=0;i<3,i++){
for(int j=0;j<4;j++){
if(A[i][j]!='*' && A[i][j]!='#'){
string ss;
ss.append(A[i][j];
CreateTeleNum(NumArray,A,ss, i, j,level+1);
}
}
else if(level<6){
string2=stringNum;
string2.append(A[i][j]);
CreateTeleNum(NumArray,A,StringNum,i,j,level+1);
if( (i+1<3)&&(j+2)){
if(A[i+1][j+2]!='*' && A[i+1][j+2]!='#'){
............................
}
}
.................
consider other 4 situation
}
else if(level==6){
NumArray.push_back(StringNum);
}

- Linkan Chen, UFL, 1-352-328-6704 February 04, 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