📣 黑五网一特惠|VIP一年通行证5折,蓝莓、Offer多多同步特惠
回复: 20
跳转到指定楼层
上一主题 下一主题
收起左侧

臉書面經

全局:

2017(1-3月) 码农类General 博士 全职@meta - 内推 - Onsite  | | Pass | 应届毕业生

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

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

x
1. design typeahead -- 從如何boostrap trie到trie sha
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
b) detect if two range overlaps


上一篇:来一发BB电面面经求onsite求人品~~~
下一篇:耶儿普 SKYPE 热乎乎的面筋

本帖被以下淘专辑推荐:

推荐
linjin 2017-10-9 01:08:05 | 只看该作者
全局:
您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
回复

使用道具 举报

推荐
codemonk 2017-10-8 20:59:54 | 只看该作者
全局:
codemonk 发表于 2017-10-8 20:30
自己写了下。 不知道这个对不对

发现一个bug。 不止j,i也可能出现在previous pair里面。添加了一个test case,更新了代码。
  1. /*
  2. The idea is: use hashmaps to cache all the visited pair sum. We maintain two hashmaps: sum2index2cnt is to cache the sum and index frequency in pairs to make the sum; sum2paircnt is to store how many pairs can make that sum. NOTE here, i,j could appear in the previous visited pairs to make -sum, which is not valid. So we need to make sure there is a previous pair of -sum that does not contain i,j index.

  3. Two loops O(N^2) time, O(N^2) space
  4. */
  5. bool fourSumTwoLoops(vector<int>& nums) {
  6.     int n = nums.size();
  7.     if(n < 4) return false;
  8.     unordered_map<int, unordered_map<int, int>> sum2index2cnt; // key is the sum of a pair, value is a map as well: key is index in the pair, value is the cnt of this index in all valid pairs to make such sum
  9.     unordered_map<int, int> sum2paircnt;
  10.     for(int i = 0; i < n; i++) {
  11.         for(int j = 0; j < i; j++) {
  12.             int sum = nums[i] + nums[j];
  13.             if(sum2index2cnt.count(-sum)) { // if there are pairs previous visited that can make -sum.
  14.                 int cnt_i_pair = sum2index2cnt[-sum].count(i) ? sum2index2cnt[-sum][i] : 0;
  15.                 int cnt_j_pair = sum2index2cnt[-sum].count(j) ? sum2index2cnt[-sum][j] : 0;
  16.                 if(cnt_i_pair + cnt_j_pair != sum2paircnt[-sum]) return true; // if there is previous pair that neither contains i or j.
  17.             }
  18.             sum2index2cnt[sum][i]++;
  19.             sum2index2cnt[sum][j]++;
  20.             sum2paircnt[sum]++;
  21.         }
  22.     }
  23.     return false;
  24. }

  25. int main(int argc, const char * argv[]) {
  26.     // insert code here...
  27.     vector<int> nums = {1,2,3,4,5,6,7,8,9,10};
  28.     cout << fourSumTwoLoops(nums) << endl;
  29.    
  30.     nums = vector<int>({-1,-1,-1,3});
  31.     cout << fourSumTwoLoops(nums) << endl;
  32.    
  33.     nums = vector<int>({-10,4,1,3});
  34.     cout << fourSumTwoLoops(nums) << endl;
  35.     return 0;
  36. }
复制代码
回复

使用道具 举报

推荐
codemonk 2017-10-8 20:30:41 | 只看该作者
全局:
您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
回复

使用道具 举报

全局:
请问LZonsite之后多久拿到offer的啊?
回复

使用道具 举报

🔗
 楼主| erhkang 2017-4-12 12:07:31 | 只看该作者
全局:
琥珀色的回忆 发表于 2017-4-12 12:05
请问LZonsite之后多久拿到offer的啊?

大約兩週。其中一個面試官拖了快一週才繳交feedback.
回复

使用道具 举报

全局:
erhkang 发表于 2017-4-12 12:07
大約兩週。其中一個面試官拖了快一週才繳交feedback.

请问LZ中间有催吗?感觉催有用吗?谢谢
回复

使用道具 举报

🔗
 楼主| erhkang 2017-4-12 12:16:22 | 只看该作者
全局:
琥珀色的回忆 发表于 2017-4-12 12:12
请问LZ中间有催吗?感觉催有用吗?谢谢

面試當天HR說兩到三天有回應,第四天沒消息的時候有寄信問一下
催是有用的
回复

使用道具 举报

全局:
erhkang 发表于 2017-4-12 12:16
面試當天HR說兩到三天有回應,第四天沒消息的時候有寄信問一下
催是有用的

我去 跟LZ情况太像了 那我明天催一下 太感谢啦!
回复

使用道具 举报

🔗
houqingniao 2017-4-12 13:24:09 | 只看该作者
全局:
恭喜LZ。 请问4sum n^2 的解法是什么啊? 还有typeahead 的trie sharding是什么呀?
回复

使用道具 举报

🔗
say543 2017-4-13 14:15:16 | 只看该作者
全局:
从如何boostrap trie到trie sharding, 到end-to-end operation. 楼主能不能说说trei 你怎么sharding 的? 我猜boostrap 因该是 有background thread 来建trie?  thanks
回复

使用道具 举报

🔗
 楼主| erhkang 2017-4-13 14:20:27 | 只看该作者
全局:
您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
回复

使用道具 举报

🔗
say543 2017-4-13 14:34:00 | 只看该作者
全局:
您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
回复

使用道具 举报

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

本版积分规则

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