avatar
f*g
1
电话面试
1st:
1. 讨论我的博士研究项目
2. 如果SNMP agent不能获取数据,或者获取的数据不符合预期,如何诊断该问题?
3。我做过的最有挑战的项目是什么?
4。用邮件写代码,然后讨论我写的代码:
unsigned char * get(int sizeOfArray, int sizeOfRecord);
void release(unsigned char* ptr);
该函数可以实现:
unsigned char ** array = get(5, 10);
snprintf( array[0], 10, “hello world\n”);
snprintf( array[1], 10, “hello again\n”);
5。Java的基本概念
2nd
1。Apache的log file如何找访问量最大的网页 (用linux shell写个小script)
2。如果某网站访问量突然增加,可能是什么情况发生,如何确定各种情况(1。暂时的
Popularity激增 2. DDOS Attack 3. 网站添加新的内容)
3。Java基本概念+设计扑克牌的类
4。读reverse string的代码(基于stack和对换位置)
Onsite Interview
1. 很高级别的一个manager,介绍group, 各种behavior questions, 无任何技术问题
。我早上8:00开始interview的,估计manager还没想好题,或者不像一大早就为难我把
:D
2. Bar raiser; 如何实现phone Book(我的答案是trie,), 并要求写出insert函数;
外加一推java的基本概念
3。给一个maze:for example:4 0 5 6 1 0, 每个number代表最多可以走的步数,问
是否能从a[0]走到a[n-1]; 问如何判断Web Service 运行正常,怎样解释response
time的variance, 谈谈botnet
4. 网络题:MTU Discovery, Switch&Router, IP header, VLAN怎样实现的,路由表怎
样实现的,bitmap,hashtable. 还写了一个很简单的程序
5。HashMap如何实现的;
Userid PageID
A 1
A 2
A 3
B 2
B 3
C 1
B 4
A 4
找出最常用的3个访问序列:
对于用户A:1-2-3, 2-3-4
用户B:2-3-4
2-3-4 是最常见的
写atoi的程序
设计rent movie的类
6。lunch with hiring manager. 我对该职位的理解,为什么感兴趣,如果加入team会
如何做啊,还有QA部分; 饭后问了到网络架构题
avatar
s*8
2
Thanks for sharing!
avatar
j*u
3
thx for share..
btw你的phd是network相关的吧,居然问ip header,vlan。。。这么BT -_-

【在 f****g 的大作中提到】
: 电话面试
: 1st:
: 1. 讨论我的博士研究项目
: 2. 如果SNMP agent不能获取数据,或者获取的数据不符合预期,如何诊断该问题?
: 3。我做过的最有挑战的项目是什么?
: 4。用邮件写代码,然后讨论我写的代码:
: unsigned char * get(int sizeOfArray, int sizeOfRecord);
: void release(unsigned char* ptr);
: 该函数可以实现:
: unsigned char ** array = get(5, 10);

avatar
f*g
4
原来你的面试这么难。。。
CS部分倒好像都见过。
Network部分太难了吧。
我虽然有一个混的网络方向的EE的Master,但除了个别的,基本上都不会。。
本来还说投网络方向的,现在看还是算了吧。
题目范围太广,没法复习啊。
avatar
l*i
5
谢谢mm分享,祝好运!!
这些面试题好难啊。。。。 @@
avatar
c*n
6
What's your anwser for the following question:
4。用邮件写代码,然后讨论我写的代码:
thanks.
avatar
c*2
7
/*
sizeOfArray: how many lines
sizeOfRecord: size of each line
*/
unsigned char **get(int sizeOfArray, int sizeOfRecord)
{
unsigned char **p;
int i;

p=(char**)malloc(sizeof(char*)*sizeOfArray);
for(i=0;ip[i]=(char*)malloc((sizeOfRecord+1)*sizeof(char));
}

return p;
}
void release(unsigned char **ptr, int sizeOfArray)
{
int i;

for(i=0;ifree(ptr[i]);
}
free(ptr);
}
avatar
c*n
8
The interface of release in your implementation is different than the one in
the question. Only one parameter is used instead of two.
Thanks.

【在 c***2 的大作中提到】
: /*
: sizeOfArray: how many lines
: sizeOfRecord: size of each line
: */
: unsigned char **get(int sizeOfArray, int sizeOfRecord)
: {
: unsigned char **p;
: int i;
:
: p=(char**)malloc(sizeof(char*)*sizeOfArray);

avatar
c*n
9
The interface of release in your implementation is different than the one in
the question. Only one parameter is used instead of two.
Thanks.

【在 c***2 的大作中提到】
: /*
: sizeOfArray: how many lines
: sizeOfRecord: size of each line
: */
: unsigned char **get(int sizeOfArray, int sizeOfRecord)
: {
: unsigned char **p;
: int i;
:
: p=(char**)malloc(sizeof(char*)*sizeOfArray);

avatar
c*n
10
ding.
avatar
j*y
11
原题里面release就只有一个参数,而不是两个。估计ch222同学的implementation里面
的release函数的第二个参数是笔误,:-)
avatar
j*y
12
嗯,如果你说的是原题要求release()带一个参数,而ch222的代码里面release()用了
两个参数的话,确实是有区别。
不过原题是不是笔误啊?要free这样一个指针数组,必须知道其中一维的长度吧?这里
没办法用strlen()来判断的呀。
avatar
c*2
13
I can't figure out a way to implement release(char*) to free char **p.
avatar
j*y
14
There isn't such a way, actually.
avatar
l*v
15
3。给一个maze:for example:4 0 5 6 1 0, 每个number代表最多可以走的步数,问
是否能从a[0]走到a[n-1];
这个没看懂,lz能不能详细说一下.是不是和以前汽车加油的问题相似啊?
谢谢

【在 f****g 的大作中提到】
: 电话面试
: 1st:
: 1. 讨论我的博士研究项目
: 2. 如果SNMP agent不能获取数据,或者获取的数据不符合预期,如何诊断该问题?
: 3。我做过的最有挑战的项目是什么?
: 4。用邮件写代码,然后讨论我写的代码:
: unsigned char * get(int sizeOfArray, int sizeOfRecord);
: void release(unsigned char* ptr);
: 该函数可以实现:
: unsigned char ** array = get(5, 10);

avatar
l*0
16
这个题应该是怎么做的?

A 1
A 2
A 3
B 2
B 3
C 1
B 4
A 4
找出最常用的3个访问序列:
对于用户A:1-2-3, 2-3-4
用户B:2-3-4
2-3-4 是最常见的

【在 f****g 的大作中提到】
: 电话面试
: 1st:
: 1. 讨论我的博士研究项目
: 2. 如果SNMP agent不能获取数据,或者获取的数据不符合预期,如何诊断该问题?
: 3。我做过的最有挑战的项目是什么?
: 4。用邮件写代码,然后讨论我写的代码:
: unsigned char * get(int sizeOfArray, int sizeOfRecord);
: void release(unsigned char* ptr);
: 该函数可以实现:
: unsigned char ** array = get(5, 10);

avatar
l*0
17
这个题应该是怎么做的?

A 1
A 2
A 3
B 2
B 3
C 1
B 4
A 4
找出最常用的3个访问序列:
对于用户A:1-2-3, 2-3-4
用户B:2-3-4
2-3-4 是最常见的

【在 f****g 的大作中提到】
: 电话面试
: 1st:
: 1. 讨论我的博士研究项目
: 2. 如果SNMP agent不能获取数据,或者获取的数据不符合预期,如何诊断该问题?
: 3。我做过的最有挑战的项目是什么?
: 4。用邮件写代码,然后讨论我写的代码:
: unsigned char * get(int sizeOfArray, int sizeOfRecord);
: void release(unsigned char* ptr);
: 该函数可以实现:
: unsigned char ** array = get(5, 10);

avatar
f*g
18
因为是real-time, 最简单的方法就是用hash的方法做:S

【在 l*******0 的大作中提到】
: 这个题应该是怎么做的?
:
: A 1
: A 2
: A 3
: B 2
: B 3
: C 1
: B 4
: A 4

avatar
g*s
19
3没看懂。一维的迷宫?那只要有0就会失败,没有就成功吧。

【在 f****g 的大作中提到】
: 电话面试
: 1st:
: 1. 讨论我的博士研究项目
: 2. 如果SNMP agent不能获取数据,或者获取的数据不符合预期,如何诊断该问题?
: 3。我做过的最有挑战的项目是什么?
: 4。用邮件写代码,然后讨论我写的代码:
: unsigned char * get(int sizeOfArray, int sizeOfRecord);
: void release(unsigned char* ptr);
: 该函数可以实现:
: unsigned char ** array = get(5, 10);

avatar
f*g
20
举个例子就清楚了
比如说:4 0 2 5 6 这个maze就是solvable的 4就代表最多可以走4步,这样就跳到了
0,2,5,6这
个数上。 6就是目的地了:S
再比如: 1 0 1 0 1 0 这个maze一看就没解了。 已开始在maze的头,也就是1这个位
置,走一步是
0,动不了,无论怎么跳也挑不到目的地了。
我当时用的是backtracking的做法,从目的地找是否有路回到开始点。

【在 l*****v 的大作中提到】
: 3。给一个maze:for example:4 0 5 6 1 0, 每个number代表最多可以走的步数,问
: 是否能从a[0]走到a[n-1];
: 这个没看懂,lz能不能详细说一下.是不是和以前汽车加油的问题相似啊?
: 谢谢

avatar
f*g
21
有很多的路径可以从起始点到终点,number代表最多可以跳几步,0的话就得绕开。

【在 g*********s 的大作中提到】
: 3没看懂。一维的迷宫?那只要有0就会失败,没有就成功吧。
avatar
l*r
22
那个访问序列,A 1-2-3-4或者A 1-2算么?还是就是找长度为3的?如果长度不定,2-3
, 3-4, 2-4也是答案阿(any subsquence of 2-3-4)。是不是找最长的sequence?这
样2-3-4就是唯一解了。

【在 f****g 的大作中提到】
: 电话面试
: 1st:
: 1. 讨论我的博士研究项目
: 2. 如果SNMP agent不能获取数据,或者获取的数据不符合预期,如何诊断该问题?
: 3。我做过的最有挑战的项目是什么?
: 4。用邮件写代码,然后讨论我写的代码:
: unsigned char * get(int sizeOfArray, int sizeOfRecord);
: void release(unsigned char* ptr);
: 该函数可以实现:
: unsigned char ** array = get(5, 10);

avatar
l*r
23
回答最有挑战的项目之类的问题,有啥要注意的地方么?
avatar
f*g
24
这个sequence必须长度为3。对于A来说:A: 1-2-3-4, 有效序列为:1-2-3 & 2-3-4

-3

【在 l*********r 的大作中提到】
: 那个访问序列,A 1-2-3-4或者A 1-2算么?还是就是找长度为3的?如果长度不定,2-3
: , 3-4, 2-4也是答案阿(any subsquence of 2-3-4)。是不是找最长的sequence?这
: 样2-3-4就是唯一解了。

avatar
g*s
25
从左向右扫描可以得到一个graph,然后求最短路径即可。

【在 f****g 的大作中提到】
: 举个例子就清楚了
: 比如说:4 0 2 5 6 这个maze就是solvable的 4就代表最多可以走4步,这样就跳到了
: 0,2,5,6这
: 个数上。 6就是目的地了:S
: 再比如: 1 0 1 0 1 0 这个maze一看就没解了。 已开始在maze的头,也就是1这个位
: 置,走一步是
: 0,动不了,无论怎么跳也挑不到目的地了。
: 我当时用的是backtracking的做法,从目的地找是否有路回到开始点。

avatar
f*g
26
我一般讲的thesis中解决的problem。这个没什么一定之规,听起来是那么回儿事就可
以了

【在 l*********r 的大作中提到】
: 回答最有挑战的项目之类的问题,有啥要注意的地方么?
avatar
l*r
27
为啥要最短路径?只要存在路径就行了吧?
A[0]=4,就是说从node 0 加4个edge到node 1,2, 3,4。
然后是不是可以dfs 看看能不能从node 0 reach node n.

【在 g*********s 的大作中提到】
: 从左向右扫描可以得到一个graph,然后求最短路径即可。
avatar
g*s
28
unsolvable ::= shortest_length == inf.

【在 l*********r 的大作中提到】
: 为啥要最短路径?只要存在路径就行了吧?
: A[0]=4,就是说从node 0 加4个edge到node 1,2, 3,4。
: 然后是不是可以dfs 看看能不能从node 0 reach node n.

avatar
l*r
29
是不是先针对每一个user, 扫描一遍列出完整的最长的sequence, 然后用moving window提取出所有的length-3 sequence,hash sequence, value就是count。最后找count最大的就行了。

【在 f****g 的大作中提到】
: 这个sequence必须长度为3。对于A来说:A: 1-2-3-4, 有效序列为:1-2-3 & 2-3-4
:
: -3

avatar
l*r
30
是可以做,不过你这样等于把题目难度增加了阿,除非你手头上正好有个现成的
shortest parth function可以调用。

【在 g*********s 的大作中提到】
: unsolvable ::= shortest_length == inf.
avatar
g*u
31

用2个hashMap做?
第一个hashMap, < user_id, Arraylist of page_id>;
然后更新第二个hashMap, .
eg.
A 1
A 2
A 3
A 4
在第一个hashmap中保存 < A, 1->2->3->4 >
在第二个hashmap中保存 2->3), 1 >
< (A,2->3->4), 1>
最后找对于每个用户访问最多的3连击就在第二个hashmap中遍历。
3。给一个maze:for example:4 0 5 6 1 0, 每个number代表最多可以走的步数,问
是否能从a[0]走到a[n-1];
马上想到的是backtracking, 不知道这个题可否用最大的单调递增序列求解?

【在 f****g 的大作中提到】
: 因为是real-time, 最简单的方法就是用hash的方法做:S
avatar
g*s
32
可以忽略边的权重,用bfs。

【在 l*********r 的大作中提到】
: 是可以做,不过你这样等于把题目难度增加了阿,除非你手头上正好有个现成的
: shortest parth function可以调用。

avatar
f*g
33
这道maze的题实际上就是一个reachability的问题。
我当时给的解法很简单:
S = {a0,a1,a2,...ai,...,an-1}
backtrace: 以an-1为起点,从右向左scan这个数组,找到一个可以到达an-1的点,再
以该点为目的
地,继续scan,直到能reach到起始点。O(n)的算法:D

【在 g**u 的大作中提到】
:
: 用2个hashMap做?
: 第一个hashMap, < user_id, Arraylist of page_id>;
: 然后更新第二个hashMap, .
: eg.
: A 1
: A 2
: A 3
: A 4
: 在第一个hashmap中保存 < A, 1->2->3->4 >

avatar
g*s
34
走着走着发现走不通怎么办?还得回溯。
你这个方法本质上就是dfs,不可能保证O(N)。

【在 f****g 的大作中提到】
: 这道maze的题实际上就是一个reachability的问题。
: 我当时给的解法很简单:
: S = {a0,a1,a2,...ai,...,an-1}
: backtrace: 以an-1为起点,从右向左scan这个数组,找到一个可以到达an-1的点,再
: 以该点为目的
: 地,继续scan,直到能reach到起始点。O(n)的算法:D

avatar
j*u
35
网页访问序列那个是典型的map reduce,2 round
maze那个可不可以这样:
bool HasPath(int[] array)
{
int max = 0; int len = array.Length;
for (int i = 0; i < len && i <= max; ++i)
{
max = Math.Max(max, i + array[i]);
if (max >= len - 1) return true;
}
return false;
}

【在 f****g 的大作中提到】
: 电话面试
: 1st:
: 1. 讨论我的博士研究项目
: 2. 如果SNMP agent不能获取数据,或者获取的数据不符合预期,如何诊断该问题?
: 3。我做过的最有挑战的项目是什么?
: 4。用邮件写代码,然后讨论我写的代码:
: unsigned char * get(int sizeOfArray, int sizeOfRecord);
: void release(unsigned char* ptr);
: 该函数可以实现:
: unsigned char ** array = get(5, 10);

avatar
l*a
36
这个题遇上1,2,1
咋算?

【在 g**u 的大作中提到】
:
: 用2个hashMap做?
: 第一个hashMap, < user_id, Arraylist of page_id>;
: 然后更新第二个hashMap, .
: eg.
: A 1
: A 2
: A 3
: A 4
: 在第一个hashmap中保存 < A, 1->2->3->4 >

avatar
j*u
37
可以问interviewer,但是通常情况下1-2-1都算合法序列
1-1-1不算,要去重

【在 l*****a 的大作中提到】
: 这个题遇上1,2,1
: 咋算?

avatar
l*a
38
what will happen is array[0]==0

【在 j*****u 的大作中提到】
: 网页访问序列那个是典型的map reduce,2 round
: maze那个可不可以这样:
: bool HasPath(int[] array)
: {
: int max = 0; int len = array.Length;
: for (int i = 0; i < len && i <= max; ++i)
: {
: max = Math.Max(max, i + array[i]);
: if (max >= len - 1) return true;
: }

avatar
j*u
39
len==1: max>=0 return true
len>1: i==1 loop breaks, return false

【在 l*****a 的大作中提到】
: what will happen is array[0]==0
avatar
g*s
40

怎么个典型法?
最好还是描述一下你的想法。没有注释的code读着很累。

【在 j*****u 的大作中提到】
: 网页访问序列那个是典型的map reduce,2 round
: maze那个可不可以这样:
: bool HasPath(int[] array)
: {
: int max = 0; int len = array.Length;
: for (int i = 0; i < len && i <= max; ++i)
: {
: max = Math.Max(max, i + array[i]);
: if (max >= len - 1) return true;
: }

avatar
l*a
41
looks good
扩展一下吧,
如果数组中元素有负数,就是可以回跳,怎么做?

【在 j*****u 的大作中提到】
: 网页访问序列那个是典型的map reduce,2 round
: maze那个可不可以这样:
: bool HasPath(int[] array)
: {
: int max = 0; int len = array.Length;
: for (int i = 0; i < len && i <= max; ++i)
: {
: max = Math.Max(max, i + array[i]);
: if (max >= len - 1) return true;
: }

avatar
j*u
42
负数可以按0处理吧,对不对?
因为在i位置时i前面的所有位置都已经考虑过了

【在 l*****a 的大作中提到】
: looks good
: 扩展一下吧,
: 如果数组中元素有负数,就是可以回跳,怎么做?

avatar
g*s
43
复杂度呢?

【在 j*****u 的大作中提到】
: 负数可以按0处理吧,对不对?
: 因为在i位置时i前面的所有位置都已经考虑过了

avatar
j*u
44
一次循环不回溯所以是O(n), space O(1)

【在 g*********s 的大作中提到】
: 复杂度呢?
avatar
g*s
45
确实。这个应该是正解。

【在 j*****u 的大作中提到】
: 一次循环不回溯所以是O(n), space O(1)
avatar
g*s
46
如果是类似jerryju的解法,但是从尾到头倒推,确实也能做到O(N)。

【在 g*********s 的大作中提到】
: 走着走着发现走不通怎么办?还得回溯。
: 你这个方法本质上就是dfs,不可能保证O(N)。

avatar
f*g
47
不会阿。 比如终点是An-1,从右向左scan,找到最近的可以reach到An-1的点
,比如那个点是
Ai;如果还有其他点也可以到达An-1,比如 Ai-2, Ai-3;那么Ai
-2, Ai-3
也可以到达Ai,或者说这些点也是在后续考虑到达Ai的集合中。

【在 g*********s 的大作中提到】
: 走着走着发现走不通怎么办?还得回溯。
: 你这个方法本质上就是dfs,不可能保证O(N)。

avatar
f*g
48
这个可以作为一个特殊的case;上来可以判断是unsolvable的

【在 l*****a 的大作中提到】
: what will happen is array[0]==0
avatar
d*n
49
//pseudo code (c# like). it can be updated to record the path(s).
public bool CanReachTheMazeEnd(int[] input)
{
if(input == null || input.Length == 0) return false;
return CanReachTheMazeEndRecursive(input, 0, 0);
}
private bool CanReachTheMazeEndRecursive(int[] input, int index, int step)
{
if(index+step == input.Length-1) return true;

for(int i=1; i{
if(CanReachTheMazeEndRecursive(input, index+step, i))
{
return true;
}
}
return false;
}

【在 f****g 的大作中提到】
: 举个例子就清楚了
: 比如说:4 0 2 5 6 这个maze就是solvable的 4就代表最多可以走4步,这样就跳到了
: 0,2,5,6这
: 个数上。 6就是目的地了:S
: 再比如: 1 0 1 0 1 0 这个maze一看就没解了。 已开始在maze的头,也就是1这个位
: 置,走一步是
: 0,动不了,无论怎么跳也挑不到目的地了。
: 我当时用的是backtracking的做法,从目的地找是否有路回到开始点。

avatar
d*n
50
之前回贴没看第二页
看了才发现jerryju的解法真巧妙

【在 j*****u 的大作中提到】
: 网页访问序列那个是典型的map reduce,2 round
: maze那个可不可以这样:
: bool HasPath(int[] array)
: {
: int max = 0; int len = array.Length;
: for (int i = 0; i < len && i <= max; ++i)
: {
: max = Math.Max(max, i + array[i]);
: if (max >= len - 1) return true;
: }

avatar
g*x
51
// DP: f(n-1) = max{f(i)}, where i from n to n-1+a[n-1] and ibool maze(const vector &vec)
{
if(vec.size() < 2)
return true;
vector reach(vec.size(), false); // reachability of the nth pos to
the last pos
reach[reach.size() - 1] = true; // last position is always reachable to
itself
for(int i = reach.size() - 2; i >= 0; --i)
{
for(int j = i + 1; j <= i + vec[i] && j < reach.size(); ++j)
if(reach[j] == true)
{
reach[i] = true; // reachable
break;
}
}
return reach[0]; // reachability from position 0
}
avatar
g*x
52
// DP: f(n-1) = max{f(i)}, where i from n to n-1+a[n-1] and ibool maze(const vector &vec)
{
if(vec.size() < 2)
return true;
vector reach(vec.size(), false); // reachability of the nth pos to
the last pos
reach[reach.size() - 1] = true; // last position is always reachable to
itself
for(int i = reach.size() - 2; i >= 0; --i)
{
for(int j = i + 1; j <= i + vec[i] && j < reach.size(); ++j)
if(reach[j] == true)
{
reach[i] = true; // reachable
break;
}
}
return reach[0]; // reachability from position 0
}
avatar
l*3
53
1. Maze Problem
set the farest reachable position, Max = 0;
cur = 0;
while ( cur <= Max )
do
if ( cur + Maze[cur] > Max )
Max = cur + Maze[cur];
if ( Max >= length(Maze-1) )
return reachable;
cur++;
endwhile
return unreachable;
The time complexity is O(N).
2. Popular 3-hit problem:
Build two hash tables, the first Hc for the customers, the second Hp for
the 3-hit links.
Scan the hitting records, adding the hit record into Hc one by one.
When the new affected customer in Hc has 3 links, add the counter of
links in Hp, remove the first link in the three links in Hc. In this process
, track the maximum count number in Hp.
Finally, we got the most popular 3-hit llinks.
The time complexity is O(N), where N is the number of hitting records,
the space complexity is also O(N).

【在 f****g 的大作中提到】
: 电话面试
: 1st:
: 1. 讨论我的博士研究项目
: 2. 如果SNMP agent不能获取数据,或者获取的数据不符合预期,如何诊断该问题?
: 3。我做过的最有挑战的项目是什么?
: 4。用邮件写代码,然后讨论我写的代码:
: unsigned char * get(int sizeOfArray, int sizeOfRecord);
: void release(unsigned char* ptr);
: 该函数可以实现:
: unsigned char ** array = get(5, 10);

avatar
f*t
54
Thanks for sharing.
这种设计扑克牌,phonebook的题,怎么回答或者准备?
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。