10月28,K神开课讲数据科学,你来吗?


一亩三分地论坛

 找回密码
 获取更多干活,快来注册
Babeltime游戏工作室招工程师、美术和策划
Tubi TV招安卓、前端和机器学习工程师
把贵司招聘信息放这里
查看: 1177|回复: 4
收起左侧

Google电面题两道

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

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

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

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

x
Google Doc上直接扒下来的,两道题都不难但是第一题从没遇到过经过提示后才想出来的,第二题别人发过面经
. 鍥磋鎴戜滑@1point 3 acres. From 1point 3acres bbs
—--

Do a quick approximation of the number of bytes needed to store a timestamp value in microseconds-google 1point3acres

that will span until the beginning of 2020?

Quick approximation: --> come up with an answer without doing complicated operations (i.e. no .1point3acres缃
. more info on 1point3acres.com
calculator, just back of the envelope computations).
. 1point3acres.com/bbs
1s = 1000*1000ms

1min = 60s

1h = 60 m

1d 24 h
.1point3acres缃
1y = 365d. from: 1point3acres.com/bbs

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

10^14

2^3.X

2^14*3=2^42

42/8 = 5.. 涓浜-涓夊垎-鍦帮紝鐙鍙戝竷

6bytes

————--
. more info on 1point3acres.com. 鐣欏鐢宠璁哄潧-涓浜╀笁鍒嗗湴
Given a string of 0s, 1s, and ?s (wildcards), generate all 0-1 strings that match an input pattern.

For example:

0?1 --> 001, 011

1?00?101 -> 10000101, 10001101, 11000101, 11001101.1point3acres缃

You can generate the strings in any order that suits you.
.1point3acres缃
public List<String> wildcard(String str){.鏈枃鍘熷垱鑷1point3acres璁哄潧
.鐣欏璁哄潧-涓浜-涓夊垎鍦
if(str == null || str.length() == 0){
throw new IllegalArgumentException();
}

List<String> result = new ArrayList<String>();. 1point3acres.com/bbs

helper(str, result );

return result;

}
-google 1point3acres
public void helper(String str, List<String> result){

if(!str.contains(“?”)){
result.add(str);. 鐗涗汉浜戦泦,涓浜╀笁鍒嗗湴
return;
}

int index = 0
. visit 1point3acres.com for more.
for(; index < str.length(); index ++){. 鐗涗汉浜戦泦,涓浜╀笁鍒嗗湴
if(str.charAt(index) == ‘?’){. From 1point 3acres bbs
break;
}

}

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

helper(new String(strCharArray), result);

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

helper(new String(strCharArray), result);. 涓浜-涓夊垎-鍦帮紝鐙鍙戝竷

}
. visit 1point3acres.com for more.
averillzheng 发表于 2014-11-23 01:28:56 | 显示全部楼层
1s = 1000 * 1000ms,.鏈枃鍘熷垱鑷1point3acres璁哄潧
是不是有点笔误,还是我记错了?
回复 支持 反对

使用道具 举报

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

使用道具 举报

averillzheng 发表于 2014-11-23 01:35:40 | 显示全部楼层
boy27910230 发表于 2014-11-23 01:33
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-9-19 19:53

Powered by Discuz! X3

© 2001-2013 Comsenz Inc. Design By HUXTeam

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