2015亚马逊90min test

真是好奇怪。收到的test是90min,一道题,7个test cases。
google了一下题目完全木有线索…都不知道为什么。话不多说了,贴上原题。


A log file contains customer ID and page-type the customer has visited for all customers. This data is stored in a time-sorted order(latest entry is last). Please implement a procedure to find the most popular 3 page type sequence for all customers. A page type sequence for a given customer is the order in which the customer visits different pages on the website. 

So a 3 page type sequence for a given customer is the combination of 3 consecutive pages that the customer visits on the website. The most popular 3 page sequence will be the most frequently occurring sequence across all customers. In case of a tie, return the sequence that appeared first in the log file. Your solution will be evaluted on correctness, runtime complexity(big-O), and adherence to coding best practices.

= =看来这种90分钟的都是这道题,我用两个hashtable, 一个存出现顺序,每当顺序达到三个的时候放入第二个hashtable(用来存出现次数)。遍历第二个hashtable,得到最大。注意check种类是否一样。

来源于 一亩三分地BBS
个人资料
onion
等级:6
文章:51篇
访问:4.2w
排名: 12
上一篇: 2014亚马逊OA笔经
下一篇:2015Amazon的SDE测试方向的OA
猜你感兴趣的圈子:
笔试面试心得
标签: customer、sequence、page、customers、90min、面试题
隐藏