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

Dropbox挂经换米

全局:

2016(10-12月) 码农类General 硕士 全职@dropbox - 网上海投 - HR筛选  | | Fail | 在职跳槽

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

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

x
1. LC379. Design Phone Directory
这题是主要的挂因,10分钟之内顺利写了常见的两种写法
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies
er见面具体描述职位细节,我假装很有兴趣。

对方最后的评价是总体很好,但1. 代码需要hint 2. 代码有detail的问题 3. 没有什么交流火花(这也算)。据了。
Dropbox的面经题不多,这回碰到的我都看过并且写过,但写的不深入,或者没用这么多方法写。希望以后发面经的同学能发些细节,帮助准备的同学好多加注意。

评分

参与人数 11大米 +124 收起 理由
jackalsin + 2 很有用的信息!
phw + 3 很有用的信息!
耿超 + 3 给你点个赞!
yoyou1988 + 5 很有用的信息!
wuliang + 3 给你点个赞!

查看全部评分


上一篇:Facebook production engineer system 最后轮实习求经验分享
下一篇:Google 11.17 面经
推荐
 楼主| zsll 2016-12-23 06:38:03 | 只看该作者
全局:
274132666 发表于 2016-12-20 20:05
楼主之前电面面的什么题呀

电面我直接贴代码了,一共两轮,都是面经常见的:1是找重复文件,2是给电话号码找能由字典中的词组成的号码
  1. Recruiter feedback:
  2. Coding needs hints
  3. Not enough attention to detail
  4. Interviewers think it's flat, it will need more spikes



  5. Interview Outline:
  6. 1 presentation
  7. 9:45 - 5:45
  8. 2 - 3 coding questions (data structure)

  9. concurrency
  10. coding about multi-threading, event driving program

  11. 1 cultrual interview (your recent project, how you tackle problem, how you work with your team, your personal passion, impact other people in the company
  12. What if your team is not doing well. Do you tell your manager. Do you do nothing
  13. How do you
  14. )
  15. project deep dive interview (15 - 25minutes, drive, how to refine)

  16. 1 hiring manager (professional development)





  17. Phone interview 1:
  18. import java.io.*;
  19. import java.util.*;

  20. /*
  21. * To execute Java, please define "static void main" on a class
  22. * named Solution.
  23. *
  24. * If you need more classes, simply define them inline.
  25. */
  26. //1 m, phone issue
  27. //I am starting my phone

  28. // 👍

  29. //Something wrong, call failed

  30. // Yeah, hm, let's see if my personal phone works...
  31. // Can you join https://bluejeans.com/4273619641

  32. class Solution {
  33.   public static void main(String[] args) {
  34.     print();
  35.   }
  36.   
  37.   static List<List<String>> findDuplicates(String path);
  38.     List<List<String>> res = new ArrayList<List<String>>();
  39.     if(path != null && path.length() > 0) {
  40.       List<List<String>> files = findFileOfSameSize(path);
  41.       for(List<String> filegroup : files) {
  42.         HashMap<String, List<String>> h = new HashMap<String, List<String>>();
  43.         HashSet<String> s = new HashSet<String>();
  44.         for(String f : filegroup) {
  45.           String hash = checksum(f);
  46.           if(!h.containsKey(hash)) {
  47.             h.put(hash, new ArrayList<String>());
  48.           }
  49.           h.get(hash).add(f);
  50.           if(h.get(hash).size() > 1) {
  51.             s.add(hash);
  52.           }
  53.         }
  54.         for(String hash : s) {
  55.           res.add(h.get(hash);
  56.         }
  57.       }
  58.     }
  59.     return res;
  60.   }

  61.   static List<List<String>> findFileOfSameSize(String path) {
  62.     List<List<String>> res = new ArrayList<List<String>>();
  63.     if(path != null && path.length() > 0) {
  64.       Stack<String> s = new Stack<String>();
  65.       s.push(path);
  66.       HashMap<Integer, List<String>> h = new HashMap<Integer, List<String>>();
  67.       HashSet<Integer> set = new HashSet<Integer>();
  68.       while(!s.empty()) {
  69.         String cur = s.pop();
  70.         if(!isDir(cur)) {
  71.           int size = getFileSize(cur);
  72.           if(!h.containsKey(size)) {
  73.             h.put(size, new ArrayList<String>());
  74.           }
  75.           h.get(size).add(cur);
  76.           if(h.get(size).size() > 1) {
  77.             set.add(size);
  78.           }
  79.         } else {
  80.            List<String> children = listDir(cur);
  81.            for(String child : children) {
  82.               s.push(child);
  83.            }
  84.         }
  85.       }
  86.       for(Integer size : set) {
  87.         res.add(h.get(size));
  88.       }
  89.     }
  90.     return res;
  91.   }
  92.   
  93. }

  94. // List<List<String>> findDuplicates(String path);

  95. // /foo/bar.txt -> 'hello'
  96. // /baz.txt -> 'bye'
  97. // /bat.txt -> 'hello'
  98. // /three.four -> 'hello'

  99. // '/' -> [['/foo/bar.txt', '/baz.txt', '/three.four']]
  100. //String checkSum(String path)

  101. // bool isDir(String path)
  102. // int getFileSize(String filePath)
  103. // List<String> listDir(String path)
  104. // String joinPath(directory, path)


  105. //If there is a symlink 怎么办,防止loop


















  106. Phone Interview 2:

  107. import java.io.*;
  108. import java.util.*;

  109. /*
  110. * To execute Java, please define "static void main" on a class
  111. * named Solution.
  112. *
  113. * If you need more classes, simply define them inline.


  114. 1 - nothing
  115. 2 - ABC
  116. 3 - DEF
  117. 4 - ...
  118. ...
  119. 7 - PQRS
  120. ...
  121. 9 - WXYZ
  122. 0 - nothing

  123. 1-800-FASTCAR
  124. 1-800-DROPBOX
  125. 1-800-376....

  126. 4667364 -> what word(s) can be made from this number (return as list)

  127. dictionary is 50k
  128. */

  129. class Solution {
  130.   public static void main(String[] args) {
  131.     HashSet<String> dict = new HashSet<String>();
  132.     dict.add("fast");
  133.     dict.add("car");
  134.     dict.add("drop");
  135.     dict.add("box");
  136.     dict.add("exactly"); //3922859
  137.     dict.add("ken");
  138.     dict.add("park");
  139.     dict.add("kenpark");
  140.     //HashSet<String> res = find("3922859", dict);
  141.     HashSet<String> res = find("5367275", dict);
  142.     //dfs(dict, res, new StringBuffer(), "222");
  143.     for(String s : res) {
  144.       System.out.println(s);
  145.     }
  146.    
  147.    
  148.    
  149.   }
  150.   
  151.   
  152.   
  153.   static void find2(String query, HashSet<String> dict, int start, List<HashSet<String>> pre, HashSet<String> res) {
  154.     if(start == query.length()) {
  155.       dfs2(res, pre, new StringBuffer(), 0);
  156.     } else {
  157.       for(int i = start + 3; i < query.length(); i++) {
  158.         String subQuery = query.substring(start, i);
  159.         HashSet<String> subRes = new HashSet<String>();
  160.         dfs(dic, subRes, new StringBuffer(), subQuery);
  161.         if(subRes.size() > 0) {
  162.           pre.add(subRes);
  163.           find2(query, dict, i, pre);
  164.           pre.remove(pre.size() - 1);
  165.         }
  166.       }
  167.     }
  168.   }
  169.   
  170.   void dfs2(HashSet<String> res, List<HashSet<String>> pre, StringBuffer sb, int start) {
  171.       if(start == pre.size()) {
  172.         res.add(new String(sb));
  173.       } else {
  174.         for( String s : pre.get(start)) {
  175.           int oriLen = sb.length();
  176.           sb.append(s);
  177.           dfs2(res, pre, sb, start + 1);
  178.           sb.setLength(oriLen);
  179.         }
  180.       }
  181.   }
  182.   
  183.   
  184.   static HashSet<String> find(String query, HashSet<String> dict) {
  185.     HashSet<String> res = new HashSet<String>();
  186.     if(query != null && query.length() == 7 && dict != null) {
  187.       String a1 = query.substring(0, 4), b1 = query.substring(4, 7);
  188.       HashSet<String> firstRes = findHelper(a1, b1, dict);
  189.       res.addAll(firstRes);
  190.       a1 = query.substring(0, 3);
  191.       b1 = query.substring(3, 7);
  192.       HashSet<String> secRes = findHelper(a1, b1, dict);
  193.       res.addAll(secRes);
  194.       HashSet<String> thirdRes = new HashSet<String>();
  195.       dfs(dict, thirdRes, new StringBuffer(), query);
  196.       res.addAll(thirdRes);
  197.     }
  198.     return res;
  199.   }
  200.          
  201.   static HashSet<String> findHelper(String a1, String b1, HashSet<String> dict) {
  202.     HashSet<String> a1Res = new HashSet<String>();
  203.     dfs(dict, a1Res, new StringBuffer(), a1);
  204.     HashSet<String> b1Res = new HashSet<String>();
  205.     dfs(dict, b1Res, new StringBuffer(), b1);
  206.     HashSet<String> res = new HashSet<String>();
  207.     for(String a : a1Res) {
  208.       for(String b : b1Res) {
  209.         res.add(a + b);
  210.       }
  211.     }
  212.     return res;
  213.   }
  214.   
  215.   static void dfs(HashSet<String> dict, HashSet<String> res, StringBuffer sb, String query) {
  216.     if(sb.length() == query.length()) {
  217.       String word = new String(sb);
  218.       if(dict.contains(word)) {
  219.          res.add(word);
  220.       }
  221.     } else {
  222.       char [][] keys = {
  223.         {' '},
  224.         {' '},
  225.         {'a','b','c'},
  226.         {'d','e','f'},
  227.         {'g','h','i'},
  228.         {'j','k','l'},
  229.         {'m','n','o'},
  230.         {'p','q','r','s'},
  231.         {'t','u','v'},
  232.         {'w','x','y','z'}
  233.       };
  234.       int pos = sb.length();
  235.       char [] chars = keys[query.charAt(pos) - '0'];
  236.       for(char c : chars) {
  237.         sb.append(c);
  238.         dfs(dict, res, sb, query);
  239.         sb.deleteCharAt(sb.length() - 1);
  240.       }
  241.     }
  242.   }
  243. }
复制代码

评分

参与人数 4大米 +19 收起 理由
frk + 3 很有用的信息!
江城渔翁 + 1 给你点个赞!
ForTheKing + 5 很有用的信息!
FightOn + 10 很有用的信息!

查看全部评分

回复

使用道具 举报

推荐
 楼主| zsll 2016-12-12 07:47:08 | 只看该作者
全局:
milolyfcmu 发表于 2016-12-11 01:12
楼主可否详细描述下爬虫这题?没懂是问什么要做什么?

爬虫就是提供一个List<String> parse(String url) function还有一个初始url,要求遍历所有的子url。
回复

使用道具 举报

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

使用道具 举报

无效楼层,该帖已经被删除
🔗
Didi313 2016-12-2 04:34:31 | 只看该作者
全局:
请问楼主Onsite之后多久收到的消息?
回复

使用道具 举报

🔗
 楼主| zsll 2016-12-2 04:46:49 | 只看该作者
全局:
横跨感恩节,三个工作日有的消息,她本来答应一天就行。没问冷冻期的事。
回复

使用道具 举报

🔗
小逻辑 2016-12-8 10:42:40 | 只看该作者
全局:
问下楼主,Design Phone Directory这个怎么用page table来做??page table??
回复

使用道具 举报

🔗
JunoJ 2016-12-8 10:54:23 | 只看该作者
全局:
word 天,这也太难了,下个月电面,心慌慌
回复

使用道具 举报

🔗
小逻辑 2016-12-8 12:19:53 | 只看该作者
全局:
哦哦,我明白了,LZ人真nice!因为我对page table的概念不是很熟,所以开始一头雾水怎么做,现在感觉道理上跟用TREE差不多哈~

补充内容 (2016-12-8 12:21):
哦对了,你说注意使用内存的意思是面试官会问的很具体存储大小什么的嘛?
回复

使用道具 举报

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

使用道具 举报

🔗
 楼主| zsll 2016-12-8 13:45:36 | 只看该作者
全局:
小逻辑 发表于 2016-12-8 12:19
哦哦,我明白了,LZ人真nice!因为我对page table的概念不是很熟,所以开始一头雾水怎么做,现在感觉道理上 ...

要具体到给1m id 需要多少MB内存
回复

使用道具 举报

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

本版积分规则

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