一亩三分地论坛

 找回密码
 获取更多干货,去instant注册!

一亩三分地官方iOS手机应用下载
查看: 969|回复: 4
收起左侧

Google电面题两道

[复制链接] |试试Instant~ |关注本帖
boy27910230 发表于 2014-11-23 00:54:50 | 显示全部楼层 |阅读模式

2014(10-12月) 码农类 硕士 全职@Google - 内推 - 技术电面 |Pass

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

您需要 登录 才可以下载或查看,没有帐号?获取更多干货,去instant注册!

x
Google Doc上直接扒下来的,两道题都不难但是第一题从没遇到过经过提示后才想出来的,第二题别人发过面经

—--
.鐣欏璁哄潧-涓浜-涓夊垎鍦
Do a quick approximation of the number of bytes needed to store a timestamp value in microseconds
. 1point 3acres 璁哄潧
that will span until the beginning of 2020?
.鏈枃鍘熷垱鑷1point3acres璁哄潧
Quick approximation: --> come up with an answer without doing complicated operations (i.e. no

calculator, just back of the envelope computations).

1s = 1000*1000ms

1min = 60s
.1point3acres缃
1h = 60 m

1d 24 h

1y = 365d

1 timestamp = 6* 365*24*60*60*1000*1000
鏉ユ簮涓浜.涓夊垎鍦拌鍧.
10^14

2^3.X

2^14*3=2^42. more info on 1point3acres.com

42/8 = 5.

6bytes
. more info on 1point3acres.com
————--. 1point 3acres 璁哄潧

. 鍥磋鎴戜滑@1point 3 acresGiven a string of 0s, 1s, and ?s (wildcards), generate all 0-1 strings that match an input pattern.. From 1point 3acres bbs

. more info on 1point3acres.comFor example:

0?1 --> 001, 011

1?00?101 -> 10000101, 10001101, 11000101, 11001101

You can generate the strings in any order that suits you. . 鐣欏鐢宠璁哄潧-涓浜╀笁鍒嗗湴
.1point3acres缃
public List<String> wildcard(String str){. 1point 3acres 璁哄潧
. Waral 鍗氬鏈夋洿澶氭枃绔,
if(str == null || str.length() == 0){
throw new IllegalArgumentException();.鏈枃鍘熷垱鑷1point3acres璁哄潧
}

List<String> result = new ArrayList<String>();

helper(str, result );
鏉ユ簮涓浜.涓夊垎鍦拌鍧.
return result;

}

public void helper(String str, List<String> result){. Waral 鍗氬鏈夋洿澶氭枃绔,

if(!str.contains(“?”)){
result.add(str);
return;
}.鏈枃鍘熷垱鑷1point3acres璁哄潧

int index = 0

for(; index < str.length(); index ++){
if(str.charAt(index) == ‘?’){. 1point3acres.com/bbs
break;
}

}

char[] strCharArray = str.toCharArray();
-google 1point3acres
strCharArray[index] = ‘0’;. more info on 1point3acres.com

helper(new String(strCharArray), result);. 鍥磋鎴戜滑@1point 3 acres

strCharArray[index] = ‘1’;. 1point3acres.com/bbs

helper(new String(strCharArray), result);

}

averillzheng 发表于 2014-11-23 01:28:56 | 显示全部楼层
关注一亩三分地公众号:
Warald_一亩三分地
1s = 1000 * 1000ms,
是不是有点笔误,还是我记错了?
回复 支持 反对

使用道具 举报

 楼主| boy27910230 发表于 2014-11-23 01:33:20 来自手机 | 显示全部楼层
关注一亩三分地微博:
Warald
ms是microsecond, 不是millisecond
回复 支持 反对

使用道具 举报

averillzheng 发表于 2014-11-23 01:35:40 | 显示全部楼层
boy27910230 发表于 2014-11-23 01:33. more info on 1point3acres.com
ms是microsecond, 不是millisecond

. Waral 鍗氬鏈夋洿澶氭枃绔,喔,我没有看清题目。

面壁ing
回复 支持 反对

使用道具 举报

averillzheng 发表于 2014-11-23 01:36:29 | 显示全部楼层
boy27910230 发表于 2014-11-23 01:33
ms是microsecond, 不是millisecond

恭喜恭喜,onsite马上就要来了
回复 支持 反对

使用道具 举报

本版积分规则

关闭

一亩三分地推荐上一条 /5 下一条

手机版|小黑屋|一亩三分地论坛声明 ( 沪ICP备11015994号 )

custom counter

GMT+8, 2017-5-1 05:29

Powered by Discuz! X3

© 2001-2013 Comsenz Inc. Design By HUXTeam

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