推荐:数据科学课程和书籍清单以及培训讲座


一亩三分地论坛

 找回密码
 获取更多干活,快来注册

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

Google电面题两道

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

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

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

您需要 登录 才可以下载或查看,没有帐号?获取更多干活,快来注册

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

Do a quick approximation of the number of bytes needed to store a timestamp value in microseconds

that will span until the beginning of 2020?

Quick approximation: --> come up with an answer without doing complicated operations (i.e. no

calculator, just back of the envelope computations).. 1point3acres.com/bbs

1s = 1000*1000ms.鏈枃鍘熷垱鑷1point3acres璁哄潧

1min = 60s

1h = 60 m

1d 24 h

1y = 365d

1 timestamp = 6* 365*24*60*60*1000*1000

10^14
. Waral 鍗氬鏈夋洿澶氭枃绔,
2^3.X

2^14*3=2^42. more info on 1point3acres.com
. 1point 3acres 璁哄潧
42/8 = 5.

6bytes
.鏈枃鍘熷垱鑷1point3acres璁哄潧
————--

Given a string of 0s, 1s, and ?s (wildcards), generate all 0-1 strings that match an input pattern.
. 1point3acres.com/bbs
For example:

0?1 --> 001, 011

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

You can generate the strings in any order that suits you.

public List<String> wildcard(String str){

if(str == null || str.length() == 0){
throw new IllegalArgumentException();
}

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

helper(str, result );. Waral 鍗氬鏈夋洿澶氭枃绔,
. Waral 鍗氬鏈夋洿澶氭枃绔,
return result;
. visit 1point3acres.com for more.. more info on 1point3acres.com
}

public void helper(String str, List<String> result){
. 鐣欏鐢宠璁哄潧-涓浜╀笁鍒嗗湴
if(!str.contains(“?”)){
result.add(str);
return;
}

int index = 0. Waral 鍗氬鏈夋洿澶氭枃绔,

for(; index < str.length(); index ++){
if(str.charAt(index) == ‘?’){
break;
}
. 涓浜-涓夊垎-鍦帮紝鐙鍙戝竷
}

char[] strCharArray = str.toCharArray();.1point3acres缃

strCharArray[index] = ‘0’;
.鐣欏璁哄潧-涓浜-涓夊垎鍦
helper(new String(strCharArray), result);

strCharArray[index] = ‘1’;

helper(new String(strCharArray), result);
. visit 1point3acres.com for more.
}

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

使用道具 举报

 楼主| boy27910230 发表于 2014-11-23 01:33:20 来自手机 | 显示全部楼层
ms是microsecond, 不是millisecond
回复 支持 反对

使用道具 举报

averillzheng 发表于 2014-11-23 01:35:40 | 显示全部楼层
boy27910230 发表于 2014-11-23 01:33. From 1point 3acres bbs
ms是microsecond, 不是millisecond

喔,我没有看清题目。

面壁ing
回复 支持 反对

使用道具 举报

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

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

使用道具 举报

本版积分规则

关闭

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

手机版|小黑屋|一亩三分地论坛声明

custom counter

GMT+8, 2017-8-20 23:39

Powered by Discuz! X3

© 2001-2013 Comsenz Inc. Design By HUXTeam

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