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

google电面+onsite+加面

全局:

2016(7-9月) 码农类General 硕士 全职@google - 猎头 - Onsite  | | Other | 在职跳槽

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

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

x
发面经,攒人品!

phone第一题:
input是两个string,例如:"google", "algorithm"
output是一个string,按above例子就是:"lggooe"
写出一个function实现这个过程

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

加面:
                        
  • 给两个数。假设为2和7。我们来玩一个游戏。
规则:将每一个数组中每一位两两相减,得到的绝对值如果不在这个array里,就append在这个array后面。求所有可能的解。



2. 炸弹人 只不过是用光和墙来表示。问站在哪里能照到更多的光。
follow up。如果这个matrix很大很大,而且很sparse,怎么存?怎么解?

3. 一个图,里面的节点有值和颜色。黑色绿色和红色。求所有 开始节点和经过的节点全是绿色,终点是黑色的 路径
               


评分

参与人数 6大米 +265 收起 理由
admin + 200
Johannazzz + 1 感谢分享!
WhatsFLAG + 1 很有用的信息!
muybienw + 10 感谢分享!
Henry要工作 + 3 感谢分享!

查看全部评分


上一篇:求coursera onsite面经,还有找伙伴
下一篇:Arista 跪经

本帖被以下淘专辑推荐:

推荐
rabbithui 2016-10-7 04:16:08 | 只看该作者
全局:
第一题:

import java.lang.Math; // headers MUST be above the first class
import java.util.*;

// one class needs to have a main() method
public class HelloWorld
{
  // arguments are passed using the text field below this editor
  public static void main(String[] args)
  {
    OtherClass myObject = new OtherClass();
           System.out.println(myObject.get("google","algorithm"));
  }
}

// you can add other public classes to this editor in any order
public class OtherClass
{
  public String get(String original,String order){
          HashMap<Character,String> map=new HashMap<>();
   
    for(int i=0;i<order.length();i++){
      char c=order.charAt(i);
      map.put(c,"");
    }
   
    String tail="";
    for(int i=0;i<original.length();i++){
      char c=original.charAt(i);
      if(map.containsKey(c)){
              map.put(c,map.get(c)+c);
      }
      else
        tail+=c;
    }
   
    String result="";
    for(int i=0;i<order.length();i++){
      char c=order.charAt(i);
      result+=map.get(c);
    }
   
    result+=tail;
   
    return result;
  }
}
回复

使用道具 举报

全局:
LZ 's information:
phone第二题:
十个人赛跑,有好几个裁判。每个裁判提供一部分人的到达终点的前后顺序。
问怎么得出完整结果。
第一个裁判给的结果是:参赛者到终点顺序为:2 9 4 3
这个意思是,选手2在选手9 之前到达终点,选手9在选手4之前,选手4在选手3之前。

My guess and solution, could LZ verify below is right or not:
Question: give you partly relative sequence to get whole sort sequence
give you 7518, 6718, 9436, 2967  to get : 294367518
Solution pseudo  code :
initial array [1,2,3,4,5,6,7,8,9]
while the relative position in [7518, 6718, 9436, 2967] is not same as the relative position in array:
swap the element in array to make sure the relative position in array is same as in [7518, 6718, 9436, 2967]

123456789 + 7518 --> 723456189 + 6718 --> 623457189 + 9436 --> 923457186 + 2967 (first round finish)--> 293456187 + 7518 (second round begin) --> 293476518 + 6718 --> 293467518 + 9436 --> 294367518 (bingo!)

It really hard.


补充内容 (2016-9-17 01:12):
This solution come out from myself is Naive.
Here is the right solution:
http://stackoverflow.com/questio ... nown-order-sequence
Google ask this in phone, OMG
回复

使用道具 举报

🔗
wtcupup 2016-9-16 01:36:59 | 只看该作者
全局:
电面第一题什么意思啊?
回复

使用道具 举报

🔗
 楼主| hcheng81 2016-9-16 01:47:38 | 只看该作者
全局:
wtcupup 发表于 2016-9-16 01:36
电面第一题什么意思啊?

他就是给你input 和 output的信息 让你推断出做了什么,再写出来 这个意思。
回复

使用道具 举报

🔗
Ridingstar01 2016-9-16 01:48:39 | 只看该作者
全局:
楼主加面是怎么个情况。。当天加的还是之后加的。。
回复

使用道具 举报

🔗
 楼主| hcheng81 2016-9-16 01:53:26 | 只看该作者
全局:
Ridingstar01 发表于 2016-9-16 01:48
楼主加面是怎么个情况。。当天加的还是之后加的。。

不知道。。。可能是意见有分歧或者是第一次面的太简单了。我在nyc面的。

补充内容 (2016-9-16 01:59):
阿,是之后一周通知我再去一次的。
回复

使用道具 举报

🔗
wtcupup 2016-9-16 01:57:15 | 只看该作者
全局:
hcheng81 发表于 2016-9-16 01:47
他就是给你input 和 output的信息 让你推断出做了什么,再写出来 这个意思。

所以能说说两个string 发生了什么?没看出规律
回复

使用道具 举报

🔗
superbinhugo 2016-9-16 02:03:41 | 只看该作者
全局:
我的天,现在都8轮onsite了啊= =
回复

使用道具 举报

🔗
lxxxxxxx 2016-9-16 02:04:00 | 只看该作者
全局:
第一题是把string1中的char按string2中的出现顺序排序? 想知道剩下的该咋办,例如不是google而是googlep 那么e和p都没出现是保留原始顺序么?
回复

使用道具 举报

🔗
hello2pig 2016-9-16 02:04:29 | 只看该作者
全局:
wtcupup 发表于 2016-9-16 01:57
所以能说说两个string 发生了什么?没看出规律

应该是对一个string重新排序吧,char的数据依照第二个string出现的次序

补充内容 (2016-9-16 02:04):
char的顺序
回复

使用道具 举报

🔗
 楼主| hcheng81 2016-9-16 02:11:49 | 只看该作者
全局:
lxxxxxxx 发表于 2016-9-16 02:04
第一题是把string1中的char按string2中的出现顺序排序? 想知道剩下的该咋办,例如不是google而是googlep  ...

对,保留顺序append在后面。
回复

使用道具 举报

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

本版积分规则

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