楼主: celtspirit
跳转到指定楼层
上一主题 下一主题
收起左侧

FB 昂赛

🔗
 楼主| celtspirit 2017-1-31 09:55:23 | 只看该作者
全局:
wkvictor 发表于 2016-12-29 06:05
求问lz 总结FB BQ的帖子在哪儿?我只找到了一个general的(http://www.1point3acres.com/bbs/forum.php?mod ...

就看的这个
回复

使用道具 举报

🔗
 楼主| celtspirit 2017-1-31 09:55:41 | 只看该作者
全局:
lela900900 发表于 2017-1-26 13:50
lz 你这是面的fb infrastructure? 他家infra 主要是做什么的?考system design看样子很深?

面试内容都是general的
回复

使用道具 举报

🔗
 楼主| celtspirit 2017-1-31 09:56:06 | 只看该作者
全局:
zjiang42 发表于 2017-1-27 16:27
请问楼主 friend relationship那个题目 应该需要自己建一下graph吗,刚才想了下貌似不能省掉那步。后面在按 ...

我是自己建了graph
回复

使用道具 举报

🔗
wsrrzxl 2017-2-2 02:28:23 | 只看该作者
全局:
请问楼主他家通知是用电话还是邮件
回复

使用道具 举报

🔗
zneofrost 2017-2-7 09:42:11 | 只看该作者
全局:
同问楼主last visited key那题,是不是类似于lru。然后follow up使用set又是什么意思。
回复

使用道具 举报

🔗
cooperkid 2017-2-14 10:07:51 | 只看该作者
全局:
问楼主的结果是电话还是邮件出的?
回复

使用道具 举报

🔗
yikehongxin 2017-2-14 14:14:35 | 只看该作者
全局:
关于第三题的design,如果是设计题目,那应该不是考察数据结构吧,各类数据结构应该都不是他想要的答案吧。我觉得考察的是类似倒排索引的东西,然后简单说一下倒排索引是怎么一回事。最后考虑一下FB的用户个数,决定如果存储?
回复

使用道具 举报

🔗
bigbearlake 2017-2-20 01:16:52 | 只看该作者
全局:
洗了下第四题,
  1. public class MinimumSteps {

  2.     public static void main(String[] args) {
  3.         MinimumSteps ms = new MinimumSteps();
  4.         int[] arr = {1, 2, 3, 0, 4};
  5.         System.out.println(ms.getMinimumSteps(arr));
  6.     }

  7.     public int getMinimumSteps(int[] arr) {
  8.         if (arr == null || arr.length == 0) {
  9.             return 0;
  10.         }

  11.         int[] dp = new int[arr.length];
  12.         Arrays.fill(dp, Integer.MAX_VALUE);
  13.         dp[0] = 1;
  14.         for (int i = 1; i < arr.length; i++) {
  15.             for (int j = 0; j < i; j++) {
  16.                 if (dp[j] != Integer.MAX_VALUE && j + arr[j] >= i) {
  17.                     dp[i] = Math.min(dp[j] + 1, dp[i]);
  18.                 }
  19.             }
  20.         }
  21.         
  22.         return dp[arr.length - 1];
  23.     }
  24. }
复制代码
回复

使用道具 举报

🔗
bigbearlake 2017-2-20 01:17:54 | 只看该作者
全局:
第四题,
  1. public class Group {

  2.     public static void  main(String[] args) {
  3.         Group g = new Group();
  4.         int[][] rs =  {{1, 2}, {2,3}, {3,4}};
  5.         List<Set<Integer>> res = g.getGroup(rs);
  6.         for (int i = 0; i < res.size(); i++) {
  7.             for (int k : res.get(i)) {
  8.                 System.out.print(k + " ");
  9.             }
  10.             System.out.println();
  11.         }
  12.     }

  13.     public List<Set<Integer>> getGroup(int[][]  relations) {
  14.         List<Set<Integer>> res = new ArrayList<>();
  15.         if (relations == null || relations.length == 0) {
  16.             return res;
  17.         }

  18.         HashMap<Integer, Set<Integer>> map = new HashMap<>();
  19.         for (int[] r : relations) {
  20.             if (!map.containsKey(r[0])) {
  21.                 map.put(r[0], new HashSet<>());
  22.             }
  23.             if (!map.containsKey(r[1])) {
  24.                 map.put(r[1], new HashSet<>());
  25.             }
  26.             map.get(r[0]).add(r[1]);
  27.             map.get(r[1]).add(r[0]);
  28.         }

  29.         Set<Integer> set1 = new HashSet<>();
  30.         Set<Integer> set2 = new HashSet<>();
  31.         boolean flag = true;
  32.         Queue<Integer> queue = new LinkedList<>();
  33.         queue.offer(relations[0][0]);
  34.         set1.add(relations[0][0]);
  35.         while (!queue.isEmpty()) {
  36.             int size = queue.size();
  37.             for (int i = 0; i < size; i++) {
  38.                 int cur = queue.poll();
  39.                 if ((flag && set2.contains(cur)) || (!flag && set1.contains(cur))) {
  40.                     return res;
  41.                 }
  42.                 if (!set1.contains(cur) && !set2.contains(cur)) {
  43.                     if (flag) {
  44.                         set1.add(cur);
  45.                     } else {
  46.                         set2.add(cur);
  47.                     }
  48.                 }
  49.                 for (int k : map.get(cur)) {
  50.                     if (!set1.contains(k) && !set2.contains(k)) {
  51.                         queue.offer(k);
  52.                     }
  53.                 }
  54.             }
  55.             flag = !flag;
  56.         }

  57.         res.add(set1);
  58.         res.add(set2);

  59.         return res;
  60.     }
  61. }
复制代码
回复

使用道具 举报

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

使用道具 举报

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

本版积分规则

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