Groupon Interview Question
Software Engineer / DevelopersCountry: United States
Interview Type: Phone Interview
As you pass through the log line by line remember the last 2 page visits of all the users, when the 3rd page is encountered increase the count of the sequence in hashmap, at the same time have 2 variables freqseq, freqseqcount where freqseq is the most frequently used sequence and freqseqcount is the number of times it has occurred. As we increase the count in the hashmap update these 2 values as well. Finally you will remain with desired value in freqseq.
A better explanation of question-
- aopencv July 18, 2013Given a web log which consists of fields 'User ' 'Page url'. We have to find out the most frequent 3-page sequence that users takes.
There is a time stamp. and it is not guaranteed that the single user access will be logged sequentially it could be like user1 Page1 user2 Pagex user1 Page2 User10 Pagex user1 Page 3 her User1s page sequence is page1-> page2-> page 3