Groupon Interview Report
- 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