Epic Systems Interview Question for Developer Program Engineers


Country: United States




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

Save the integers as a HashMap where key is the integer and value is the number of occurences. Then following program solves it.

package epic_passwords;

import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Set;

public class Passwords {
	private static HashMap<Integer,Integer> password = new HashMap<Integer,Integer>();
	private static LinkedList<Integer> oneCombination = new LinkedList<Integer>();
	
	public static void main(String[] args){
		password.put(1, 1);
		password.put(9, 3);
		password.put(4, 2);
		findCombi(password, oneCombination);
	}
	
	private static void findCombi(HashMap<Integer,Integer> password, LinkedList<Integer> oneCombination){
		Set<Integer> keys = password.keySet();
		Iterator<Integer> keysItr = keys.iterator();
		//Integer keyRemoved = null;
		Integer value;
		while(keysItr.hasNext()){
			Integer key = keysItr.next();
			if(password.get(key)==0){
				continue;
			}else{
				value = password.get(key);
				value--;
				password.put(key, value);
			}
			oneCombination.add(key);
			showPassword(oneCombination);
			findCombi(password, oneCombination);
			oneCombination.removeLast();
			value++;
			password.put(key, value);
		}
	}
	
	private static void showPassword(LinkedList<Integer> oneCombination){
		int size = oneCombination.size();
		System.out.println("\n");
		for(int i=0; i<size; i++){
			System.out.print(oneCombination.get(i));
		}
	}
	
}

- s100banerjee May 02, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public class Combination {


public static void main(String[] args) {
permutation("", "123");
}


private static void permutation(String prefix, String str) {

int n = str.length();

if(n ==0)
System.out.println(prefix);
else {
for(int i = 0; i<n ;i++){
permutation(prefix+str.charAt(i), str.substring(0,i)+str.substring(i+1));
}

}
}
}

- venky June 01, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public class Combination {


public static void main(String[] args) {
permutation("", "123");
}


private static void permutation(String prefix, String str) {

int n = str.length();

if(n ==0)
System.out.println(prefix);
else {
for(int i = 0; i<n ;i++){
permutation(prefix+str.charAt(i), str.substring(0,i)+str.substring(i+1));
}
}
}
}

- venky June 01, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Thanks Venky!!!!!!!!!

- Pradeep Mishra June 25, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;
int main()
{
char st[]="231";
int len=strlen(st);
sort(st,st+len);
do
{
cout<<st<<endl;
}while(next_permutation(st,st+len));
return 0;
}

- pbox September 09, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public static void main(String args[]) {
permuteString("", "123");
}

public static void permuteString(String beginningString, String endingString) {
if (endingString.length() <= 1)
System.out.println(beginningString + endingString);
else
for (int i = 0; i < endingString.length(); i++) {
try {
// System.out.println(i);
String newString = endingString.substring(0, i) + endingString.substring(i + 1);
permuteString(beginningString + endingString.charAt(i), newString);
} catch (StringIndexOutOfBoundsException exception) {
exception.printStackTrace();
}
}
}

- Rishii October 01, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public static void main(String args[]) {
permuteString("", "123");
}

public static void permuteString(String beginningString, String endingString) {
if (endingString.length() <= 1)
System.out.println(beginningString + endingString);
else
for (int i = 0; i < endingString.length(); i++) {
try {
// System.out.println(i);
String newString = endingString.substring(0, i) + endingString.substring(i + 1);
permuteString(beginningString + endingString.charAt(i), newString);
} catch (StringIndexOutOfBoundsException exception) {
exception.printStackTrace();
}
}
}

- Rishi October 01, 2015 | 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