📣 独立日限时特惠: VIP通行证立减$68
回复: 12
跳转到指定楼层
上一主题 下一主题
收起左侧

脸家现场表演

全局:

2019(7-9月) 码农类General 本科 全职@meta - 内推 - Onsite  | | Pass | 应届毕业生

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
本帖最后由 吉姆一帆风顺 于 2019-10-15 19:01 编辑


10/07的UDay,10/14收了口头offer.


第一轮: 1) 一串儿数字,要求找出出现次数为奇数的那个数(仅有一个或不存在)。             2)利口幺六腰  要求想
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies
和什么样的同事工作,你领导给过你的建设性的反馈,etc。反手出了一道 利口溜尔伊 变种 要求preserve task order

面完还以为挂了,无心参加后续游园活动,于是吃完午饭就溜了。

评分

参与人数 7大米 +19 收起 理由
匿名用户-4XQSX + 10
jdwqtm + 1 给你点个赞!
MercuryT + 2 给你点个赞!
math2cool + 1 给你点个赞!
yiliaobailiao + 2 给你点个赞!

查看全部评分


上一篇:Airbnb 刚出炉视频面试!
下一篇:Wayfair Summer Intern OA
推荐
thyang93 2019-10-15 23:49:00 | 只看该作者
全局:
yiliaobailiao 发表于 2019-10-15 23:11
请问 第二轮第一题,怎么能在O(1)时间内实现呢?

类似LRU?
1. 用一个doubly linkedlist(或者LinkedHashMap)来维护插入元素的顺序
2. 再用一个HashMap 来记录unique元素在DLL中的位置(key:char, value:Node)
3. 还需要一个HashSet seen记录见过的重复元素

对于下一个元素,先看是不是存在于seen,如果不在但是存在于DLL,从DLL删掉(O(1)),并加入seen,如果是第一次见到,那么从末端插入(O(1)),最后返回头端的元素。
回复

使用道具 举报

推荐
 楼主| 吉姆一帆风顺 2019-10-16 00:31:24 | 只看该作者
全局:
yiliaobailiao 发表于 2019-10-15 23:11
请问 第二轮第一题,怎么能在O(1)时间内实现呢?

我是用了一个double ended queue + hashmap.
Use the hashmap to keep track of number of occurrence for each element. When we see a new character, check from the head of the queue and remove nonunique characters.
回复

使用道具 举报

推荐
 楼主| 吉姆一帆风顺 2019-10-16 01:41:23 | 只看该作者
全局:
thyang93 发表于 2019-10-16 01:06
I don't think this is amortized O(1). If you use a queue, each time you scan through the elements  ...

Assuming you encounter the duplicate character at index (n+1), you only need to do a O(n) scanning at the (n+1)-th time of data feed. (Since it's a data stream, you process character one at a time.) Since we do O(n) scanning per n times of data feed call, the operation is amortized O(1). Please follow up if things are still not clear.

And yes, you were right that we only need a hashset to tell if a character has been seen before. That's what I did in the interview.
回复

使用道具 举报

🔗
taikoolyd 2019-10-15 19:55:25 | 只看该作者
全局:
10.3 uday 没结果的是不是凉了
回复

使用道具 举报

🔗
yiliaobailiao 2019-10-15 23:11:41 | 只看该作者
全局:
请问 第二轮第一题,怎么能在O(1)时间内实现呢?
回复

使用道具 举报

🔗
yiliaobailiao 2019-10-16 00:00:30 | 只看该作者
全局:
thyang93 发表于 2019-10-15 23:49
类似LRU?
1. 用一个doubly linkedlist(或者LinkedHashMap)来维护插入元素的顺序
2. 再用一个HashMap ...

哦哦。明白了。多谢多谢
回复

使用道具 举报

🔗
 楼主| 吉姆一帆风顺 2019-10-16 00:28:42 | 只看该作者
全局:
taikoolyd 发表于 2019-10-15 19:55
10.3 uday 没结果的是不是凉了

不一定吧。因为我15号有个offer deadline,所以可能加快给我结果了?
回复

使用道具 举报

🔗
thyang93 2019-10-16 01:06:35 | 只看该作者
全局:
吉姆一帆风顺 发表于 2019-10-16 00:31
我是用了一个double ended queue + hashmap.
Use the hashmap to keep track of number of occurrence f ...

I don't think this is amortized O(1). If you use a queue, each time you scan through the elements in the queue, it will take O(n). Also, as you stated, we only need to check if a char is unique, we probably do not need to cache the occurrence of a char, we just need to know if it has been seen.
回复

使用道具 举报

全局:
恭喜lz,紫薯紫薯
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表