一亩三分地论坛

 找回密码
 获取更多干货,去instant注册!

扫码关注一亩三分地公众号
查看: 1626|回复: 4
收起左侧

pure storage onsite

[复制链接] |试试Instant~ |关注本帖
lea82 发表于 2016-6-8 06:17:16 | 显示全部楼层 |阅读模式

2016(4-6月) 码农类 硕士 全职@pure storage - 内推 - Onsite |Fail在职跳槽

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

您需要 登录 才可以下载或查看,没有帐号?获取更多干货,去instant注册!

x
2 old questions:. From 1point 3acres bbs
implement a set, so that add, remove, lookup, clear operations would have O(1) time complexity, iteration would have O(size) complexity.
they don't like to jump to the right answer, kind of feel that they want you start using one array, and then another modification, and then combine both methods
Solution is 2 arrays, map[n], list[n] where for map, the index is the data x, the value is its index in list: map[2] = 0 if you first add a 2 to list.
list[n] stores the real value of the data
remove is from map[x] you find the index in list, you swap the list[--size] with list[map[x]]
for clear, you just set size to be 0
to lookup an item x, map[x]<size && list[map[x]] == true, return true.

2nd question is event dispatch system,
at time line, there are coming listeners for event fire, before event fire happens, queue these listeners (void register(CallBack cb)). when event fire happens(void fire()), process these events
single thread, multithread situation.. 涓浜-涓夊垎-鍦帮紝鐙鍙戝竷

Again I feel that they don't want you to jump directly to the right answer.. 鐣欏鐢宠璁哄潧-涓浜╀笁鍒嗗湴

Single thread in Java:
boolean isFired = false;
Queue<Callback> q = new Queue<Callback>();
. 鐗涗汉浜戦泦,

评分

2

查看全部评分

firemusume 发表于 2016-6-14 08:52:46 | 显示全部楼层
你好,最近也在准备这家。请问您是在哪里onsite的啊,只有两道题吗?
回复 支持 反对

使用道具 举报

 楼主| lea82 发表于 2016-6-15 04:33:44 | 显示全部楼层
firemusume 发表于 2016-6-14 08:52
你好,最近也在准备这家。请问您是在哪里onsite的啊,只有两道题吗?
. 鐗涗汉浜戦泦,涓浜╀笁鍒嗗湴
mountain view.

I got 2 rounds, 1st round only 2 questions.

2nd round onsite for 3 questions.
回复 支持 反对

使用道具 举报

firemusume 发表于 2016-6-15 06:00:52 | 显示全部楼层
lea82 发表于 2016-6-15 04:33
mountain view.

I got 2 rounds, 1st round only 2 questions.

谢谢回复。不知能分享下round2的题目吗,或者楼主还没有去round2?
回复 支持 反对

使用道具 举报

Urumic 发表于 2016-6-16 07:49:36 | 显示全部楼层
请问楼主两轮onsite是同一线还是不同的日子呢?请问楼主方便的话能私信我后面的三道题吗?谢谢楼主。
回复 支持 反对

使用道具 举报

本版积分规则

请点这里访问我们的新网站:一亩三分地Instant.

Instant搜索更强大,不扣积分,内容组织的更好更整洁!目前仍在beta版本,努力完善中!反馈请点这里

关闭

一亩三分地推荐上一条 /5 下一条

手机版|小黑屋|一亩三分地论坛声明 ( 沪ICP备11015994号 )

custom counter

GMT+8, 2016-12-7 02:00

Powered by Discuz! X3

© 2001-2013 Comsenz Inc. Design By HUXTeam

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