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

BB电面以及电面面经整理

全局:

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

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

x
BB面经
1. 325 Maximum Size Subarray Sum Equals K
2. Missing number, binary search(since it is ordered)
3. binary tree, get grandparent node value

TreeNode grandpa = null;
  public int getGrandPa(TreeNode root) {

      getParentValue(root, 2);
      System.out.println(grandpa == null ? null : grandpa.val);
      return -1;
  }
  private void getParentValue(TreeNode root, int node){
      if(root == null || (root.left == null && root.right == null)){
          return;
      }
      if(root.left.left == null && root.left.right == null && root.right.left == null && root.right.right == null){
          return;
      }
      if(((root.left.left != null) && root.left.left.val == node) ||
      (root.left.right != null && root.left.right.val == node) ||
      (root.right.right != null && root.right.left.val == node) ||
      (root.right.right != null && root.right.right.val == node)){
          grandpa = root;
          return;
      }
      getParentValue(root.left, node);
      getParentValue(root.right, node);
  }


  helper(TreeNode child,TreeNode parent){
          map.put(child, parent);
          if(child.left != null){
                  helper(chiled.left, child);
          }
          if(child.right != null){
                  helper(child.right, child);
          }
  }


4. 跑马问题
一个max heap + hashmap存马和节点关系
5.岛屿周长问题(考到了)
dfs也行,islands * 4 - neighbours * 2

6.intersection of two array

7.unique value stack
LRU cache的思想,double linked list + hashmap

8.Find top 10 most frequent words in an array of strings.
bucket sort. bucket sort的思想就是把freq table generate出来以后,建立一个 buckets[],
map.put(n, map.getOrDefault(n, 0) + 1);

9.Coding: Given an input array, print the first longest substring with contiguous same
characters. (e.g. abbbc -> bbb, abbbcbb -> bbb)
sliding window
10.reverse integer, follow up: 小数怎么办,分开整呗
double value = 3.25;
double fractionalPart = value % 1;
double integralPart = value - fractionalPart;

整数换小数
private static double convert(int a){
    int temp = a;
    double i = 1 ;
    while(a > 0){
        i = i * 10;
        a = a / 10;
    }
    return temp / i;
}

11.
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies
row){
                            System.out.print(array[r][c] + " ");
                            r++;
                            c--;
                    }
                    System.out.println();
            }
            for(int j = 1 ; j < row ; j++){
                    int r = j;
                    int c = col - 1;
                    while(r < row ){
                            System.out.print(array[r][c] + " ");
                            r++;
                            c--;
                    }
                    System.out.println();
            }
     }
32.soft reference, weak refenrence
33.魔方表面刷漆,拆成27个以后,拿一个向上扔,top是黑的概率(6* 1 + 8 * 3 + 12 * 2)/ 27 * 6
34.print linked list 从尾到头
printList(Listnode<E> llist) {
    if (llist == null) {
        return;
    }
    printList(llist.getNext());
    System.out.println(llist.getData());
}
35.fibonacci递归和iterative
public int fibonacci(int n) {
        if(n <= 1){
            return 0;
        }
        return helper(n - 2, 1, 0);
    }

private int helper(int n, int pre, int prepre){
        if(n == 0){
            return pre;
        }
        return helper(n - 1, pre + prepre , pre);
}

36.
two sum各种变形
1.没sort -> hashset
2.sort -> two pointers
3.有重复,就while loop 跳过重复,如果用的是two pointers

加油!


评分

参与人数 4大米 +93 收起 理由
紫衣云梦小怪兽 + 80 很有用的信息!
maxwl + 5 感谢分享!
asssssssss17 + 3 感谢楼主!正需要!
Emerson_Ding + 5 很有用的信息!

查看全部评分


上一篇:谷歌YouTube有近期ONSITE的吗?
下一篇:google , adobe , baidu , research intern
🔗
 楼主| dunan00001 2017-1-19 01:55:24 | 只看该作者
全局:
楼主已经拿到Onsite啦 大家要加油!!!!!!
回复

使用道具 举报

🔗
shayne93 2017-1-20 13:25:48 | 只看该作者
全局:
弱弱地问一下lz, 这是bb所有的店面题了???
回复

使用道具 举报

🔗
 楼主| dunan00001 2017-1-20 14:17:53 | 只看该作者
全局:
shayne93 发表于 2017-1-20 13:25
弱弱地问一下lz, 这是bb所有的店面题了???

显然不是。。。。。地里还有好多 我只是整理了一部分。。。
回复

使用道具 举报

🔗
shayne93 2017-1-21 02:53:02 | 只看该作者
全局:
dunan00001 发表于 2017-1-20 14:17
显然不是。。。。。地里还有好多 我只是整理了一部分。。。

哈哈 随便问问 多谢多谢
回复

使用道具 举报

🔗
lavendernan 2017-1-21 10:19:09 | 只看该作者
全局:
楼主是只写了function吗?
回复

使用道具 举报

🔗
 楼主| dunan00001 2017-1-21 14:07:01 | 只看该作者
全局:
lavendernan 发表于 2017-1-21 10:19
楼主是只写了function吗?

啥意思?
回复

使用道具 举报

🔗
lavendernan 2017-1-22 11:29:57 | 只看该作者
全局:

是不是只写function,不用自己写test case跑
回复

使用道具 举报

🔗
 楼主| dunan00001 2017-1-22 11:46:00 | 只看该作者
全局:
lavendernan 发表于 2017-1-22 11:29
是不是只写function,不用自己写test case跑

恩 我没跑 不过很多人都跑啦
回复

使用道具 举报

全局:
楼主碰到的是原题吗?
回复

使用道具 举报

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

本版积分规则

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