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

Airbnb phone interview

全局:

2019(1-3月) 码农类General 博士 全职@airbnb - 内推 - 技术电面  | | Fail | 在职跳槽

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

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

x
45 min phone coding session for one question only.

您好!
本帖隐藏的内容需要积分高于 200 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 200 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies


The expectation is to finish the code and have some test cases, and my performance is below that bar.
Never try to solve a NP problem, and was shocked the expectation is a bug-free brute force solution.

评分

参与人数 2大米 +13 收起 理由
mren + 3 给你点个赞!
Lingzviee + 10

查看全部评分


上一篇:Apple信仰的力量
下一篇:亚麻新加坡OA
🔗
jason524 2019-3-3 09:54:58 | 只看该作者
全局:
根据地里的面经 这题好久没考了 个人感觉不适合面试
回复

使用道具 举报

🔗
 楼主| jscw 2019-3-3 09:57:49 | 只看该作者
全局:
jason524 发表于 2019-3-3 09:54
根据地里的面经 这题好久没考了 个人感觉不适合面试

agree. don't see the point to test coding ability by this question.
unfortunately I was the interviewee, not the interviewer.
回复

使用道具 举报

全局:
这家确实很随缘,啥题bar都是一样,主要看运气遇到啥题
回复

使用道具 举报

🔗
hj867955629 2019-3-17 11:38:07 | 只看该作者
全局:
就是用SCC先把每个强连通分量当成一个点,此时图里不会再有环,再数有多少个入度为0的点就行。
回复

使用道具 举报

🔗
qlxf 2019-3-17 21:49:11 | 只看该作者
全局:
哪道题目? 积分不够
回复

使用道具 举报

🔗
mren 2019-3-18 15:39:38 | 只看该作者
全局:
这题我感觉就先把入度为0的点全去掉就可以了,然后剩下的就是入度为0的点,剩下几个全返回,代码很简单,如果不对请指正:
  1. import java.util.*;

  2. public class MinNodesToTraverseGraph {

  3.     private void DFS(Set<Integer> visited, int index, List<Integer> ret, Map<Integer, Set<Integer>> hash) {
  4.         visited.add(index);
  5.         for(int val: hash.getOrDefault(index, new HashSet<>())) {
  6.             if(ret.contains(val)) ret.remove(val);
  7.             if(!visited.contains(val)) {
  8.                 DFS(visited, val, ret, hash);
  9.             }
  10.         }
  11.     }

  12.     public List<Integer> findMin(int[][] edges, int n) {
  13.         Map<Integer, Set<Integer>> hash = new HashMap<>();
  14.         for(int[] edge: edges) {
  15.             if(edge[0] == edge[1]) continue;
  16.             hash.computeIfAbsent(edge[0], k -> new HashSet<>()).add(edge[1]);
  17.         }
  18.         Set<Integer> visited = new HashSet<>();
  19.         List<Integer> ret = new ArrayList<>();
  20.         for(int i = 0; i <= n; i++) {
  21.             if(visited.contains(i)) continue;
  22.             ret.add(i);
  23.             DFS(visited, i, ret, hash);
  24.         }
  25.         return ret;
  26.     }

  27.     public static void main(String[] args) {
  28.         MinNodesToTraverseGraph traverseGraph = new MinNodesToTraverseGraph();
  29.         int[][] edges = new int[][] {{2, 9}, {3, 3}, {3, 5}, {3, 7}, {4, 8}, {5, 8},
  30.                 {6, 6}, {7, 4}, {8, 7}, {9, 3}, {9, 6}};
  31.         List<Integer> ret = traverseGraph.findMin(edges, 9);
  32.         for(int val: ret) {
  33.             System.out.print(val + " ");
  34.         }
  35.         System.out.println();

  36.         edges = new int[][] {{1, 2}, {2, 3}, {3, 4}, {1, 5}};
  37.         ret = traverseGraph.findMin(edges, 5);
  38.         for(int val: ret) {
  39.             System.out.print(val + " ");
  40.         }
  41.     }
  42. }
复制代码

补充内容 (2019-3-18 15:41):
入度不为0的点去掉,剩下不为0的就是答案,这里发代码格式太乱了
回复

使用道具 举报

🔗
 楼主| jscw 2020-5-6 14:03:36 | 只看该作者
全局:
Now I felt blessed to be rejected by Airbnb
回复

使用道具 举报

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

本版积分规则

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