Redian新闻
>
大家看看这几道google面试题怎么做?
avatar
大家看看这几道google面试题怎么做?# JobHunting - 待字闺中
r*t
1
刚买的象印2磅面包机,看说明书first rise和second rise之间有个过程叫stir down
,我的面包机没看见什么变化,是不是面包机有什么问题?还是需要自己把面团拿出来
揉一下,知道的同学说说看,谢谢~~
avatar
h*8
2
从这里看到的,没看到好的solution. 大家讨论一下?
* 把一个字符串转换成32bit的整数
* 一个range的序列(链表或数组),如[1,3], [2,6], [8,10],[15,18]
写程序合并有重叠的range,比如上面的序列合并为[1,6], [8,10], [15,18]
如果这个序列不是静态的,而是一个数据流,如何 处理?
Ppl mentioned interval tree, but I do not think it would work here.
* implement the merge of two int arrays A and B, using the similar way as
merge-sort
Further question:
if A's size is over the max possible value of the int array, how do u
handlethat? suppose you have enough memory (do some math here, e.g. 2^ 30, 2
^ 40.... headache)
avatar
t*3
3
The bread machine stirs a couple of times during this time.
avatar
g*s
4

interval tree works.
u always check if the latest interval has overlap with the intervals in the
tree. if not, do insert. if overlap is found, merge the overlapped one and
check the interval again. in the extreme case u only have one interval left
finally.

【在 h******8 的大作中提到】
: 从这里看到的,没看到好的solution. 大家讨论一下?
: * 把一个字符串转换成32bit的整数
: * 一个range的序列(链表或数组),如[1,3], [2,6], [8,10],[15,18]
: 写程序合并有重叠的range,比如上面的序列合并为[1,6], [8,10], [15,18]
: 如果这个序列不是静态的,而是一个数据流,如何 处理?
: Ppl mentioned interval tree, but I do not think it would work here.
: * implement the merge of two int arrays A and B, using the similar way as
: merge-sort
: Further question:
: if A's size is over the max possible value of the int array, how do u

avatar
q*d
5
在漫长的40-50min之间好像就stir down一两次
你除非守在那里
不然很难看到的
avatar
g*i
6
* 把一个字符串转换成32bit的整数
题目是要把字符串和整数11对应吗?
假设有k个character是可以用在字符串里面的,把字符串看成k进制的数字,每个字符对应一个数字(要character set转化成number set)然后转成2进制.

【在 h******8 的大作中提到】
: 从这里看到的,没看到好的solution. 大家讨论一下?
: * 把一个字符串转换成32bit的整数
: * 一个range的序列(链表或数组),如[1,3], [2,6], [8,10],[15,18]
: 写程序合并有重叠的range,比如上面的序列合并为[1,6], [8,10], [15,18]
: 如果这个序列不是静态的,而是一个数据流,如何 处理?
: Ppl mentioned interval tree, but I do not think it would work here.
: * implement the merge of two int arrays A and B, using the similar way as
: merge-sort
: Further question:
: if A's size is over the max possible value of the int array, how do u

avatar
r*t
7
xiexie~
avatar
h*8
8
There could be multiple intervals that has overlapping with the current one.
How could you do the merging stuff?

the
left

【在 g*********s 的大作中提到】
:
: interval tree works.
: u always check if the latest interval has overlap with the intervals in the
: tree. if not, do insert. if overlap is found, merge the overlapped one and
: check the interval again. in the extreme case u only have one interval left
: finally.

avatar
g*s
9
找到最左边的那个。然后开始跟next元素合并到没有重合。

one.

【在 h******8 的大作中提到】
: There could be multiple intervals that has overlapping with the current one.
: How could you do the merging stuff?
:
: the
: left

avatar
h*8
10
首先肯定不会是1-1map. 32位整数是有限的,字符串是无限的。
我觉得就是构造hash函数。但是要求collision概率小。而且hash table利用率高。我
想到的是用素数为底。

对应一个数字(要character set转化成number set)然后转成2进制.

【在 g*****i 的大作中提到】
: * 把一个字符串转换成32bit的整数
: 题目是要把字符串和整数11对应吗?
: 假设有k个character是可以用在字符串里面的,把字符串看成k进制的数字,每个字符对应一个数字(要character set转化成number set)然后转成2进制.

avatar
g*s
11
http://stackoverflow.com/questions/299304/why-does-javas-hashco
as-a-multiplier

【在 h******8 的大作中提到】
: 首先肯定不会是1-1map. 32位整数是有限的,字符串是无限的。
: 我觉得就是构造hash函数。但是要求collision概率小。而且hash table利用率高。我
: 想到的是用素数为底。
:
: 对应一个数字(要character set转化成number set)然后转成2进制.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。