两轮背靠背一轮45分钟 写代码并且要求compile+ run test cases
第一题: 给一个list of tuples [(1,2), (3,5),(4,5), (5, 9)] represents the bookings of airbnb, first num is the start date,second is the end date (start is inclusive, end is exclusive), find the way ofmaximizing the booking days in total. 比如这一题就是[(1,2), (3,5), (5,9)] -> 1 + 2 + 4 =7 没有follow - up, 要求打印path和return result days
讲一下自己的做法: dp, dp(n)代表在end date为n时候能book的最大天数。在计算dp(n)的时候traverse所有end date 为end的tuple 计算要是取这个tuple时总值是多少。然后取最大值,跟dp(n-1)比较,再取这两者的最大值存入dp(n)。path的话自己再建一个dict存一下。这个肯定是还可以优化的(楼主懒得想了哈哈) 欢迎在下面讨论噢~
第二题: 查了一下地里好像有了 api offile system create, setVal, getVal , follow up: watch function
我自己的感受: 第一轮一开始脑袋卡住,为了不冷场开始说brute force 瞎说了一会儿想到了上面写的做法幸好做出来了 test cases都过了 但是浪费了一些时间,而且小姐姐问了time complexity 我居然说错了(omg) 但是她人真的很好。因为一开始没想到最优解卡了那5-6分钟后面也没有follow -up, 不过她一开始就要我打印了how to select, 不知道这是不是intenedto be a follow up。楼主自己觉得还有个可能的follow-up是有多解的问题
第二轮做得非常顺利都做完了之后还剩8-9分钟 愉快聊天 小哥哥笑起来声音很好听
两轮面试官都是华人人超好疯狂打call 谢谢他们!
timeline:
9/28 网申
10/4 oa链接
10/6 做完OA
10/9 约背靠背
10/17 背靠背 (周末休息)
10/21 约cross-functional