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

whatsapp intern面经

全局:

2015(1-3月) 码农类General 硕士 实习@meta - 校园招聘会 - 技术电面 Onsite  | | Fail |

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

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

x
电面一轮,onsite两轮。最后悲剧了。

电面:
1. 把一个sorted list转成balanced binary search tree
2. 把sorted list转成complete binary search tre
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies
fortress写了一个实现。利用Fortress的并发特性,可以达到O(lgn)。然后被要求不用Fortress。我又用openmp给了一个多线程实现。

评分

参与人数 2大米 +8 收起 理由
atlas1017 + 5 很有用的信息!
eval + 3 感谢分享!

查看全部评分


上一篇:豌豆荚,阿里,大众点评实习面经
下一篇:Bloomberg 面经
🔗
eric108 2015-3-23 22:13:59 | 只看该作者
全局:
周三面whatsapp的fulltime,楼主这问题也太难了点吧,看来whatsapp还挺高冷的 估计没戏了
回复

使用道具 举报

🔗
然姐Carol 2015-3-25 06:06:01 | 只看该作者
全局:
实习这么个面法也是蛮拼的
回复

使用道具 举报

🔗
joseph5wu 2016-2-7 16:07:55 | 只看该作者
全局:
那个sorted list to complete BST 参考了一下前面的balanced BST的递归做法,跑了一下inorder/level order/isBST检查了一下应该没什么问题:
  1. public class Solution {
  2.     private ListNode node;

  3.     private int getDividePos(int start, int end) {
  4.         int m = end - start + 1;
  5.         int height = (int)Math.ceil(Math.log(m + 1) / Math.log(2));
  6.         if(3 * Math.pow(2, height - 2) - 1 >= m) {
  7.             return end - (int) Math.pow(2, height - 2) + 1;
  8.         }
  9.         else {
  10.             return start + (int) Math.pow(2, height - 1) - 1;
  11.         }
  12.     }

  13.     private int getLength(ListNode node) {
  14.         int length = 0;
  15.         while(node != null) {
  16.             length++;
  17.             node = node.next;
  18.         }
  19.         return length;
  20.     }

  21.     public TreeNode convert(ListNode head) {
  22.         if(head == null) {
  23.             return null;
  24.         }

  25.         this.node = head;
  26.         int length = getLength(head);
  27.         return convert(0, length - 1);
  28.     }

  29.     private TreeNode convert(int start, int end) {
  30.         if(start > end) {
  31.             return null;
  32.         }

  33.         int rootIndex = getDividePos(start, end);
  34.         TreeNode left = convert(start, rootIndex - 1);
  35.         TreeNode root = new TreeNode(node.value);
  36.         node = node.next;
  37.         TreeNode right = convert(rootIndex + 1, end);
  38.         root.left = left;
  39.         root.right = right;
  40.         return root;
  41.     }
  42. }
复制代码

回复

使用道具 举报

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

本版积分规则

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