Groupon Interview Question for Senior Software Development Engineers


Country: United States
Interview Type: Phone Interview




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

Maintain a graph.
Each node representing a Coffee flavour.
The edges to it will represent the variation in flavour.
The other end of the edge points to the resultant flavour.
You can traverse through each available flavour first to create this graph.
Then when customer asks, just tell him the adjacent nodes of his coffee.
Complexity O(V+E) for searching the node in BFS.

- Anonymous September 26, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I like this idea ; based on customer inputs we can identify how similar two coffees are! We can adjust the weights of the edges in the graph based on personal choice too! It becomes a shortest path problem. Graph DS for this problem provides good flexibility !

- gowthamrang January 24, 2016 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

You could use any algorithm like Levenshtein Distance to find the edit distance between the strings of coffee name customer is drinking and coffee flavors you have and populate top n coffee flavors order by edit distance ascending.

- MMI May 23, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Sorry if this wasn't clear, but when I said 'closest flavor matches', I did not mean in terms of the edit distances of the coffee names. You have a mapping for each coffee flavor of what other flavors taste similar to it. Although the question was open ended, one way of interpreting it would be that you are perhaps given a mapping of how different each other flavor is from a particular flavor given as an integer in a range, say 1-10, 1 being closest and 10 being farthest. You just need to store this information in an appropriate data structure and answer a customer question by accessing this data that you are given.

- thejediknight May 23, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Here is my implementation....I have made different array for each integer. (1-10, 1 being the most similar flavour, 10 being the least similar flavour). So, there shall be only 10 array lists no matter how many flavours of coffee that gets added. If there are thousand flavours, only 10 elements would be in each array at an average...So, just for implementation sake, i have created two arraylists for 1st and 2nd rank. The coffee falvours in 1st rank are those that are most similar, and similarly for subsequent flavours. When the query comes in for a coffee we shall go through 1st rank and try to find if there is coffee that is similar to it. If it is found, then the program ends or it goes onto ranks below. Here is my code...

public List<String> findSimilarCoffee(String query){
	
		ArrayList<String> oneRanking = new ArrayList<String>();
		ArrayList<String> twoRanking = new ArrayList<String>();
		Map<Integer,ArrayList<String>> mapOfCoffee = new HashMap<Integer,ArrayList<String>>();
		oneRanking.add("Capp");
		oneRanking.add("Latte");
		oneRanking.add("BlackCoffee");
		mapOfCoffee.put(1,oneRanking);
		twoRanking.add("Oranje Juice");
		twoRanking.add("Latte");
		twoRanking.add("BlackCoffee");
		mapOfCoffee.put(2,twoRanking);
		String coffee_query = new String("BlackCoffee"); //Assume the customer asks for black coffee
		List<String> listOfSimilarCofee = new ArrayList<String>();
		boolean similarCoffeeFound = false;
			for(Integer i :mapOfCoffee.keySet()){
				if(similarCoffeeFound==false){
					if(null!=mapOfCoffee.get(i) && mapOfCoffee.get(i).contains(coffee_query)){
						for(String coffee : mapOfCoffee.get(i)){
							listOfSimilarCofee.add(coffee);
							similarCoffeeFound = true;
							return listOfSimilarCofee;
					}
				}
				}
			}
			
			
		
		
	return listOfSimilarCofee;

}

- Srivats Bharadwaj May 23, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

This is a typical recommendation problem. Similar to movie-to-user recommendations, we can use collaborative filtering (+ content based recommendation systems) to suggest similar flavors.

- Anonymous November 28, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

public List<String> findSimilarCoffee(String query){

ArrayList<String> oneRanking = new ArrayList<String>();
ArrayList<String> twoRanking = new ArrayList<String>();
Map<Integer,ArrayList<String>> mapOfCoffee = new HashMap<Integer,ArrayList<String>>();
oneRanking.add("Capp");
oneRanking.add("Latte");
oneRanking.add("BlackCoffee");
mapOfCoffee.put(1,oneRanking);
twoRanking.add("Oranje Juice");
twoRanking.add("Latte");
twoRanking.add("BlackCoffee");
mapOfCoffee.put(2,twoRanking);
String coffee_query = new String("BlackCoffee"); //Assume the customer asks for black coffee
List<String> listOfSimilarCofee = new ArrayList<String>();
boolean similarCoffeeFound = false;
for(Integer i :mapOfCoffee.keySet()){
if(similarCoffeeFound==false){
if(null!=mapOfCoffee.get(i) && mapOfCoffee.get(i).contains(coffee_query)){
for(String coffee : mapOfCoffee.get(i)){
listOfSimilarCofee.add(coffee);
similarCoffeeFound = true;
return listOfSimilarCofee;
}
}
}
}




return listOfSimilarCofee;

- Anonymous May 23, 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