Yelp OA

我也是new grad,也报一下我的

这道题实际上几乎没啥难度,但是题目比较长,变量比较多而已。还有把代码写的清晰一点,自己也好debug。

OA时间比较紧,一道大题25分钟。建议第一次写的时候就尽量写的清楚一点,思路整理好了再写,争取不要出错,要不然最后只剩下几分钟在那debug真的很恐慌也很没效率的。

报一下题目

input:
event_type, occurance, biz_id

exp:
“reviews”, 7, 1
“reviews”, 3, 3
“ads”, 11, 1
“ads”, 7, 2
“ads”, 6, 3
“page_views”, 3, 1
“page_views”, 12, 2

output:
list of biz_ids that are active businesses.
An active business is the one who has more than (or equal to) 2 event_types with more than average occurances amoung all biz_ids

for example:
average for “review”, “ads”, “page_views” are 7+3/2 = 5, 11+7+6=8, 3+12/2=7.5
biz_id 1 has 7 “review” events > 5, 11"ads" events > 8, so biz_id 1 is an active business.

做完后收到店面