Epic Systems Interview Question for Software Engineer / Developers






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

#include<iostream>

void permute(char a[],int i,int j)
{
char temp;
int k=0;
if(i==j)
printf("String is %s\n",a);

else
{
for(k=i;k<j;k++)
{

temp=a[j-1];
a[j-1]=a[k];
a[k]=temp;



permute(a,i,j-1);


temp=a[j-1];
a[j-1]=a[k];
a[k]=temp;

}
}

}

int main()
{

char a[30];
printf("Enter value\n");
scanf("%s",a);

permute(a,0,strlen(a));

printf("Original String is %s\n",a);

system("PAUSE");
exit(0);

}

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

void generateString(const char*, const int, char* = NULL, int = -1);

void generateString(const char* number, const int len, char* charstring, int index)
{
static char mapping[10][4] = {{}, {}, {'A','B','C'},{'D','E','F'},{'G','H','I'},{'J','K','L'},{'M','N','O'},
{'P','Q','R','S'},{'T','U','V'},{'W','X','Y','Z'}};
static int counter = 0;

if( !charstring) {
charstring = new char[len+1];
charstring[len] = 0;
index = -1;
counter = 0;
}

if(len == 0) {
counter++;
cout<<setw(10)<<counter<<" "<<charstring<<endl;
return;
}

int val = number[0] - '0';
for(int i=0; i<4; i++) {
char c = mapping[val][i];
if(c) {
charstring[index+1] = c;
generateString(number+1, len-1, charstring, index+1);
}
}
}

- dogznm October 18, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

@dogznm
Can you elaborate or explain ur code in detail..

- Rahul Koshy June 24, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Refer Prg Interviews exposed for a non-recursive simple soln

- XYZ November 09, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Dictionary<string,string>
then trygetvalue

- Amon February 12, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

This comment has been deleted.

- Administrator August 23, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

In the example 279, when finished APX, APY, APZ, APW, how does the program manage to go back to AQ?

- chao October 09, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

.

- xxx April 22, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

int x;
    std::cin>>x;
    char mat[10][4]={
        {},
        {},
        {'A','B','C'},
        {'D','E','F'},
        {'G','H','I'},
        {'J','K','L'},
        {'M','N','O'},
        {'p','q','r','s'},
        {'t','u','v'},{'x','y','z'}};
    
    for(int j=0;j<4;j++)
        if(mat[x][j])
            std::cout<<mat[x][j]<<"\t";

- dan March 07, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include<stdio.h>
#include<string.h>

char mobnum[10][4] = {{'0','0','0','0'},
		{'0','0','0','0'},
					{'a','b','c','0'},
{'d','e','f'},
{'g','h','i'},
{'j','k','l'},
{'m','n','o'},
{'p','q','r','s'},
{'t','u','v'},
{'w','x','y','z'}};

int arrSize[] = {0,1,3,3,3,3,3,4,3,4};
void printMobToStr(char number[],char str[],int cur_num , int tot)
{
	int num = number[cur_num] - 48;
	if(cur_num == tot)
	{
		str[tot] = '\0';
		printf("%s\n",str);
		return;
	}
	for(int i=0; i < arrSize[number[cur_num]-48];i++)
	{
		str[cur_num] = mobnum[num][i];
		printMobToStr(number,str,cur_num+1,tot);
	}
	return;
}

int main()
{
	char input[10] , output[20];
	printf("Enter the string : ");
	scanf("%s",input);
	printMobToStr(input,output,0,strlen(input));
	return 0;
}

- Soma Sekhar December 11, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public static void phoneDictionary(int idx, String inp, char[] word) {
		if (idx >= word.length) {
			for (char c : word) {
				System.out.print(c);
			}
			System.out.println();
		}
		if (idx < word.length) {
			for (int i=0; i<map.get((Character) inp.charAt(idx)).length; i++) {
				word[idx] = map.get((Character) inp.charAt(idx))[i];
				phoneDictionary(idx+1,inp,word);
			}
		}
	}

- assassin November 20, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

import java.util.HashMap;


public class phonePermutations {
	static int count = 0;
public static void main(String[] args) {
		
		int num= 345;
		String number = "";
		number = String.valueOf(num);
		System.out.println(number);
		char[] numArr = new char[number.length()];
		
		for(int i = 0;i < number.length();i++){
			numArr[i] = (number.charAt(i));
		}
		for(int i = 0;i < number.length();i++){
			System.out.println(numArr[i]);
		}
		
		HashMap<Character,String> map = new HashMap<Character, String>();
		map.put('2', "abc");
		map.put('3', "def");
		map.put('4', "ghi");
		map.put('5', "jkl");
		map.put('6', "mno");
		map.put('7', "pqrs");
		map.put('8', "tuv");
		map.put('9', "wxyz");
		StringBuilder str = new StringBuilder();
		for(int i = 0;i<3;i++){
			str.append(map.get(numArr[i]));
		}
		System.out.println(str.toString());
		permute(str);

	}
	public static void permute(StringBuilder str){
		String newString = str.toString();
		int inputLength = str.length();
		boolean[] used = new boolean[inputLength];
		StringBuffer outputString = new StringBuffer();
		char[] in = newString.toCharArray();
		doPermute(in,outputString,used,inputLength,0);
	}
	private static void doPermute(char[] in, StringBuffer outputString,
			boolean[] used, int inputLength, int level) {
		
		if(level == inputLength){
			System.out.println(++count+" "+outputString.toString());
			return;
		}
		
		for(int i = 0; i < inputLength;i++ ){
			if(used[i])
				continue;
			outputString.append(in[i]);
			used[i] = true;
			doPermute(in,outputString,used,inputLength,level+1);
			used[i] = false;
			outputString.setLength(outputString.length() - 1);
		}
		
	}

}

- Tejaswi January 22, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Edit..
in one of the for loops, change the ending condition from 3 to number.length()

- Tejaswi January 22, 2015 | Flag


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