Groupon Interview Questions
- 0of 0 votes
AnswersDelhi Route Traffic Optimizer
- raghunitb March 30, 2017 in India for Workflow
Traffic congestion is an annoying issue in Delhi, the capital of India. Every morning thousands of people drivea residential area to the International Technology Park (ITPL). There are various routes one can take to reach ITPL and each route takes its own time making some routes faster than the others. People obviously take faster routes which causes congestion on those roads too. Congestion results into increased travel time, air pollution and wastage of fuel. As a Traffic commissioner of Delhi, you are asked to optimize the traffic by putting toll to various roads so that resultant cost of every route (driving time cost and toll cost) ends up the same. This has to be done in such a way that any driver pays toll only once no matter which route he/she takes.roads have one-way traffic and there is no cycle in any of the routes. You need to create a toll plan for a given road layout.
The toll plan must adhere to following rules:
1. Toll should be levied in such a way that perceived cost (base road cost and toll cost) remains same forroads.
2. The tolls should be levied such that the total cost for each route is minimized.
3. A route cannot have more than one toll.
4. In case of multiple solutions for a route, add toll to a road that is closer to destination.
In some use cases, it might be impossible to impose tolls that satisfy the above conditions.
http://qa.geeksforgeeks.org/11340/delhi-route-traffic-optimizer| Report Duplicate | Flag | PURGE
Groupon SDE1 Algorithm - 0of 0 votes
AnswersJacob and Peter have their favorite number X and Y. We have given an array with positive interger number and we need to find the longest prefix index which contain equal number of X and Y. return -1 if there is no prefix with equal number of X and Y.
Suppose we have an array A = [7,42,5,6,42,8,7,5,3,6,7]
X = 7
Y =42
Output should be 9 as prefix will be index from 0 to 9 with equal number of X and Y.
I wrote below code but this has some bug which I could not find.
- sandeepmnit35 July 28, 2016 in Indiapublic int findIndex(int A[],int N,int X,int Y) { int nx =0; int ny=0; int result = -1; for( int i=0;i<N;i++) { if(A[i] == X) nx+=1; else if(A[i] == Y) ny+=1; if(nx== ny&& nx!=0&&ny!=0) result = i; } return result; }
| Report Duplicate | Flag | PURGE
Groupon Applications Developer Algorithm - -1of 1 vote
Answershttps://gist.github.com/acegreen/e16a2259a93dab880a7f
- aelalfy1989 March 09, 2016 in United States| Report Duplicate | Flag | PURGE
Groupon iOS Developer Algorithm - 0of 0 votes
Answershttps://gist.github.com/acegreen/1a9a63f27729278b0fa5
- aelalfy1989 March 09, 2016 in United States| Report Duplicate | Flag | PURGE
Groupon iOS Developer Algorithm - 0of 0 votes
AnswersWrite a function to print Tree which can have any number of nodes, in level order each level in new line.
- snehit.gajjar June 25, 2015 in United States
1
2 3
4 5 6
if above is tree then answer should be,
1
2,3
4,5,6| Report Duplicate | Flag | PURGE
Groupon Software Engineer Algorithm - 0of 0 votes
AnswersString encoding-decoding question. Given a digit sequence, return no. of ways it can be decoded.
- Tom Walker June 07, 2015 in United States
Mapping : A->1, B->2, Z->26
For ex : Given a string "123", based on the mapping it can be decoded to following ways :-
(1) 1,2,3 -> A,B,C (2) 12,3 -> L,C (3) 1,23 -> A,W| Report Duplicate | Flag | PURGE
Groupon Software Developer - 0of 0 votes
AnswersWhat is REST? Can you explain it by giving examples.
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Groupon Software Developer - 0of 0 votes
AnswersYou have a coffee shop with say, a 1000 flavors of coffee. You always face a customer query asking for a certain number of coffee flavors that are closest matches to what they are drinking. Write a function which would take a coffee flavor and find a certain
- thejediknight May 23, 2015 in United States
number of closest flavor matches in terms of flavor.| Report Duplicate | Flag | PURGE
Groupon Senior Software Development Engineer Algorithm - 0of 0 votes
AnswersYou have a requirement where a user searches for a search term, which could be say, the title of a movie
- thejediknight May 23, 2015 in United States
and you need to find the title and then show a description of the movie. How would you implement it. Describe the data structures used. If you were going to host this service on a single machine with 250 MB of RAM while you need to handle, say 10 GB of data, how would you do this?| Report Duplicate | Flag | PURGE
Groupon Senior Software Development Engineer Algorithm - 1of 1 vote
AnswersDesign an algorithm for a thermometer that shows the Maximum and minimum temperature in the last 24 hours. The current temperature can be read in 5 second intervals.
- CodingDawg May 10, 2014 in United States
The interviewer was looking for an algorithm that is space efficient as there will be limited memory on the device. .| Report Duplicate | Flag | PURGE
Groupon Senior Software Development Engineer Algorithm - 1of 1 vote
AnswersGiven:
- poorna.chandra.akp February 21, 2014 in India for APi Team
R number of Red Cards
B number of Black cards
K
Cards needs to be placed in a circle. Start from a position and for every K moves remove that card And repeat the process until all the cards are eliminated.
Question: Position the cards such that the red cards are completely eliminated before the blacks cards are selected for elimination.| Report Duplicate | Flag | PURGE
Groupon SDE1 - 1of 1 vote
AnswersYou are given an array / sequence of colors. In this sequence / array, find a couple (both colors adjacent to each other) which are same color. Now, remove that pair. Now, after this removal, if there are further couple of same color then remove that as well and so on.
For a given array / sequence of colors, find the maximum number of couples.
- nilukush January 13, 2014 in IndiaFor eg., consider following array of colors : R G B B G R Y 1. BB is one couple, so remove it : R G G R Y 2. GG is one such couple after removing BB, so remove it : R R Y 3. RR is one such couple, so remove it : Y So, the maximum number of couples is 3. Input : Y R G G R R G G R Y Output : 5 (maximum number of couples)
| Report Duplicate | Flag | PURGE
Groupon Senior Software Development Engineer Algorithm - 0of 0 votes
AnswersYou are given a matrix. Starting from [0, 0], you have to move over the matrix in clockwise-spiral direction, i.e., we start from [0, 0], move upto [0, 4], and then move to [3, 4], then move to [3, 0], then move to [1, 0], then to [1, 3] and so on.
Move in this way and print all the elements.
- nilukush January 13, 2014 in IndiaInput : 1 2 3 4 5 6 8 9 a b c d e f g h i j k l Output : 1 2 3 4 5 b g l k j i h c 6 8 9 a f e d
| Report Duplicate | Flag | PURGE
Groupon Senior Software Development Engineer Algorithm - 0of 0 votes
AnswersCampus Interview question:
- init.d November 04, 2013 in United States
Q: What is the difference between a HashMap and HashTable?
A: HashTable is always synchronized - undesirable - HashMap is better
Q: How is ConcurrentHashMap different from Collections.tosynchronized(map)?
A: First locks individual rows the second locks whole structure| Report Duplicate | Flag | PURGE
Groupon Software Engineer / Developer - 1of 1 vote
AnswersCampus Interview question:
- init.d November 04, 2013 in United States
Design the File System for an OS.| Report Duplicate | Flag | PURGE
Groupon Software Engineer / Developer General Questions and Comments - 1of 1 vote
AnswersCampus Interview question:
- init.d November 04, 2013 in United States
Search for an element in a rotated sorted array for eg. sorted: {1, 2, 3, 4, 5, 6} rotated: {5, 6, 1, 2, 3, 4}| Report Duplicate | Flag | PURGE
Groupon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersCampus Interview question:
- init.d November 04, 2013 in United States
Find the top k items out of an array where items can have values [0... 100]| Report Duplicate | Flag | PURGE
Groupon Software Engineer / Developer Algorithm - -2of 8 votes
Answersits easy but still!!
find the largest subarray with equal number of 0's and 1's.
example 001010101
output:8
- viva August 14, 2013 in United Statesint subarray(int arr[],int n) { int count=0; for(int i=0;i<n;i++) { if(a[i]==0) count++; else count--; } if(count==0) return n; else { if(count>0) return n-count; else return n+count; } }
| Report Duplicate | Flag | PURGE
Groupon SDE1 Data Structures - 1of 1 vote
AnswersGiven a BST convert it into new Data Structure that satisfies following conditions:
- saran August 13, 2013 in India
1. every leaf node's left ptr point to its parent and right ptr points to the next leaf
2. every non leaf node's left ptr points to its parent and right ptr is NULL
3. return the head and print the new DS
example:
7
/ \
5 9
/ \ \
4 6 10
output:
head->4->5->7
|
->6->5->7
|
->10->9-7
with optimal time and space complexity| Report Duplicate | Flag | PURGE
Groupon Intern Trees and Graphs - 0of 0 votes
AnswersGiven an array, return true, if it can be partitioned into two subarrays whose sum of elements are same, else return false
- saran August 13, 2013 in India
Example:
Input: {5,1,5,11}
Output: true (as it can be divided into {5,1,5} {11} where 5+1+5=11)| Report Duplicate | Flag | PURGE
Groupon Intern Arrays - 0of 0 votes
AnswersFind the most common "3 page path" on a website given a large data log.
- aopencv July 18, 2013 in United States| Report Duplicate | Flag | PURGE
Groupon Software Engineer / Developer - -1of 1 vote
AnswersFind pairs of nums that add upto given number.
- aopencv July 18, 2013 in United States| Report Duplicate | Flag | PURGE
Groupon Software Engineer / Developer - 0of 0 votes
Answersfind K Min Values in an array
- orangetime23 June 29, 2013 in United States| Report Duplicate | Flag | PURGE
Groupon Software Engineer / Developer Algorithm - 0of 0 votes
Answersfind the indexes of Min Values in an array
- orangetime23 June 29, 2013 in United States| Report Duplicate | Flag | PURGE
Groupon Software Engineer / Developer Algorithm - 0of 0 votes
Answersfind a Min Value in an array
- orangetime23 June 29, 2013 in United States| Report Duplicate | Flag | PURGE
Groupon Software Engineer / Developer Algorithm - -2of 2 votes
AnswersGiven a string T of length n, partition it in n' "phrases" (p1, p2, ..., pn'), such that
- hakkindumma June 21, 2013 in United States
pi = pj + c, for some j<i, where + is string concatenation and c is a character
p0 = ''
p1 = pj + c where j < 1
T = p1 + p2 + ... + pn'
For example:
T = aababcabcd = a + ab + abc + abcd
p1 p2 p3 p4| Report Duplicate | Flag | PURGE
Groupon Developer Program Engineer Algorithm Java String Manipulation - 1of 1 vote
AnswersYou are given a file (and you do not know how big the file is, nor how big the lines in the file are). Write an algorithm that will generate a random number (which will be used to index into the file) such that the output of lines will be roughly proportional? That is if the file contained 4 lines, and if I ran the program 1 million times I should get each line printed approximately 250K times.
- pdenno June 08, 2013 in United States| Report Duplicate | Flag | PURGE
Groupon Algorithm - 1of 1 vote
AnswersGiven a string, find the longest possible even palindrome (length of palindrome is even) from it.
- arun_lisieux May 10, 2013 in India
Eg:
Input: abcicbbcdefggfed
Output: defggfed (length is 8)
Available palindromes are
1) bcicb - has odd length
2) cbbc - even length
3) defggfed - longest palindrome with even length
This question was asked in a telephonic interview for my friend. I will be posting his solution in a day.| Report Duplicate | Flag | PURGE
Groupon Software Engineer / Developer Algorithm Arrays Coding String Manipulation - 0of 0 votes
AnswersWrite inorder traversal without using recursion.
- krishnx May 07, 2013 in India| Report Duplicate | Flag | PURGE
Groupon Software Engineer / Developer