活人onsite面经

  1. 20’ bq’s on most challenging projects, ask about project details, then give coding problem to find best match chat agent based on input skill, the agent is like this: {String[] skills, int maxTime, int curTimeUsed} , then from the matched agents, find the top one which has the most spare time (maxTime - curTimeUsed). What I do is first pre-compute to map skills and their agents, then sort agents based on spare time, and define the api to input a skill and get top agent.
  2. 30’ With global hire recruiters, all bq’s, about most challenging projects, why leave current job, etc
  3. Lunch with engineer, mainly talks about team and products
  4. Meet with engineer, start with 20’ bq’s asking about challenging projects, ask if do it again, what could be done better. And what have you done out of your comfort area? Then coding problem, with streaming input of search queries get top 100 (or top k) most frequent ones. I gave solution using double linkedlist and map
  5. Meet with manager, ask bq’s like is there any time you missed your commitment , what did you do about that case? And any time you missed your goal? Then ask about one project I feel proud of and ask me on some details. And system design question , design a chating system like fb messager or whats app
  6. Last with one remote engineer: first just do introduce of each other, following some bq’s, then code question: given arrival and departure time of trains in a train station, return the minimum platforms needed to hold all trains at any time. Follow-up: how about train arrived at night and leaves in the morning of next day? Answer: add day value to timestamp to combine day and time

这到底算是系统设计还只是算法?

算法 就是让得出top k的query

这里的time range是什么?last hour? last day?

time 就是诸如 09:00, 19:20 这些 我是用integer表示timestamp , time range的话一开始assume是同一天内 (00:00 - 23:59)

time range 是fixed 吗?还是作为每次调用时的input?

哦 sorry 错了 time range就是一天24小时内的 就让求出一天内的top k , input 就是k, 就是说每天固定时间统计并且会reset

那其实可以用 circular array 来做 time bucket,因为 range 固定

这句话什么意思?不是 last 24 hours 吗?

这个没有时间的input 只有query 所以只是一天内固定的时间来统计 sorry for confusing!

这公司不行 亚麻文化。。。

还是没听懂,你要不举个例子。
到底是不是 last 24 hours ?

确实是last 24hrs 但是单个query的时间是不知道的

input 比如 [“a”, “b”, “Hello”, "Hello, “b”, …] 就是统计一天之内的所有query然后求top k , 一天某个固定时间来统计 比如11:00pm 输出之后就reset

还是没讲清楚,你到底会查几天前的top K 吗?
你所谓的统计一天之内,是从任意时刻开始吗?
你这需求讲不清,面试咋过 :joy:

不是任意时刻 几天前的都不用 只考虑一天 从一天内的固定时间算起

就是求当前时刻开始算的last 24 hours,对吧?

是这样 比如每天11:00pm统计 top k frequent 然后输出结果 统计完之后reset并且 11:00pm之后算作新的一天到第二天11:00pm重新统计

我看你给的是LFU的解法吧,感觉你描述的思路应该可以

但这题到底是要优化读还是写?
好像会不停stream,也就是不停写。读的频率如何?