由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - A公司的面经
相关主题
相关话题的讨论汇总
话题: int话题: fibonacci话题: return话题: fibor话题: 输出
进入JobHunting版参与讨论
1 (共1页)
M7
发帖数: 219
1
First 电面:
1. 谈一下不同数据结构的优缺点。
2. 一个大文本文件里有电话号码。每行至多有一个号码。How do you process and
return the total number of phone numbers. (in command line, use grep and wc)
3. A generic tree. how to print out nodes by level (one lever a line)
说了pseudo code, 要求电面后email给他。
4. A database application is slow. How do you investigate the problem and
how to improve it.
Second 电面:
1. 写一个函数,输出一个整数里1-bit的数目。比如CountOneBits(7)应返回3。
2. 网页很慢。找出可能原因。(和一面的最后一个问题差不多)
3. 下面statements的区别是什么?接着问了关于constructor的问题(copy), shallow
vs. deep copy.
Class A;
A a = u;
A a(u);
A a();
A a;
4. What is virtual function and polymorphism?
5. What is reflection?
6. A large time-stamped log files, 怎么找一个时间范围内logs? (grep)
7. What is the difference between hashing and encryption?
Third 电面 (口音比较重的老印。不少地方听不明白,只能不断叫他慢速重复。他人倒
是不错,很客气):
1. 谈了一下phd research
2. 一个文件里一百万个数字。怎样找到最小的100个? (Use min-heap of size 100)
Ask about complexity (nlogn)
3. 写函数 输出Fibonacci numbers in normal sequence (no loop allowed, use 递
归,
cannot compute Fibonacci number using F(X) = F(X-1) + F(X-2)) 我用了
两个static variables. 程序写好念给他听。他运行了一下说pass.
4. 写函数 输出Fibonacci numbers in reversed sequence, 和上题同样的限制。电话
里没有想出来,总觉得需要一个stack的数据结构,才能实现反序输出。他给我30分钟让
我电话后写了程序email他。最后我还是用了一个辅助的数据结构。他reply我,给了
idea. 实际上还是用两个static variable. 在recursion中计算,在foo(0)里面输出
F(X), 然后在recursion返回中在还原出F(X-1), F(X-2) …. 直到F(1), F(0).
Onsite (because of NDA, 只能说的抽象一点):
组A的dev manager:
1. OO design该公司的一个system, 设计的时候,使用patterns. 这个问题初听很
难,所以我就不断地问问题。最后把问题简化到一个可以操作的程度。这样设计起来方
便不少。
2. 如何在文件里找电话号。(他们的确喜欢grep)
Recruiter
组A的SDE:
1. 谈research
2. 给一个int array, 输出一个随机permutation. (实际上就是random shuffle) 用了
reservoir sampling. 然后演示了一下1,2,3的六种输入可能。
3. difference between i++ and ++i
4. what is virtual function? why C++ makes non-virtual default? (speed
tradeoff)
组A的SDET:
1. 写函数: given an integer, 判断这个integer, in binary format, 是不是一个回
文结构。
2. 一个binary tree of integers. serialize and then desialize.
非面试组来的面试官:
1. 谈research
2. 公司网站上有一个错误的电话号码。怎么找出来。一开始回答得有些不得要领。后来
说到要web crawl一下公司的domain, 他似乎有兴趣。于是就用bfs traverse, 用hash
table来防止infinite loop. 对于每个page, 自然还是grep来找。
组B的dev manager(lunch interview):
没问任何技术问题。基本在聊天。问我,什么才是好的程序?怎么样comment程序?很多
时候在说他们组的东西。
该公司正在从C++到java转型。但面试我的人似乎都对C++比较熟悉。至于用什么语言回
答问题完全不重要。可能我说自己C++比较熟,所以他们没有问java specific的问题。
Best wishes to all jobhunters!
s**********v
发帖数: 1379
2
thanks for sharing!

wc)
ho

【在 M7 的大作中提到】
: First 电面:
: 1. 谈一下不同数据结构的优缺点。
: 2. 一个大文本文件里有电话号码。每行至多有一个号码。How do you process and
: return the total number of phone numbers. (in command line, use grep and wc)
: 3. A generic tree. how to print out nodes by level (one lever a line)
: 说了pseudo code, 要求电面后email给他。
: 4. A database application is slow. How do you investigate the problem and
: how to improve it.
: Second 电面:
: 1. 写一个函数,输出一个整数里1-bit的数目。比如CountOneBits(7)应返回3。

D*********y
发帖数: 876
3
楼主写的很详细
多谢!
s*******t
发帖数: 248
4
thanks for sharing!

wc)

【在 M7 的大作中提到】
: First 电面:
: 1. 谈一下不同数据结构的优缺点。
: 2. 一个大文本文件里有电话号码。每行至多有一个号码。How do you process and
: return the total number of phone numbers. (in command line, use grep and wc)
: 3. A generic tree. how to print out nodes by level (one lever a line)
: 说了pseudo code, 要求电面后email给他。
: 4. A database application is slow. How do you investigate the problem and
: how to improve it.
: Second 电面:
: 1. 写一个函数,输出一个整数里1-bit的数目。比如CountOneBits(7)应返回3。

h**********d
发帖数: 4313
5
谢谢楼住的面经
请问这题可以再详细讲下解法吗
2. 公司网站上有一个错误的电话号码。怎么找出来。一开始回答得有些不得要领。后来
说到要web crawl一下公司的domain, 他似乎有兴趣。于是就用bfs traverse, 用hash
table来防止infinite loop. 对于每个page, 自然还是grep来找。
P********l
发帖数: 452
6
LZNB !
M7
发帖数: 219
7
Given some API functions:
URLList getAllURLs(File input);
File getFileFromURL(URL u);
boolean containBadPhoneNumber(File input);
把这个想成一个tree traveral. 每个页面里的URL都是这个页面的children.
同时用一个URL hashtable来防止infinite loop.
差不多了吧?

后来
hash

【在 h**********d 的大作中提到】
: 谢谢楼住的面经
: 请问这题可以再详细讲下解法吗
: 2. 公司网站上有一个错误的电话号码。怎么找出来。一开始回答得有些不得要领。后来
: 说到要web crawl一下公司的domain, 他似乎有兴趣。于是就用bfs traverse, 用hash
: table来防止infinite loop. 对于每个page, 自然还是grep来找。

j*****u
发帖数: 1133
8
congratulations!
B组只安排了一个人,被A组欺负了:P

wc)

【在 M7 的大作中提到】
: First 电面:
: 1. 谈一下不同数据结构的优缺点。
: 2. 一个大文本文件里有电话号码。每行至多有一个号码。How do you process and
: return the total number of phone numbers. (in command line, use grep and wc)
: 3. A generic tree. how to print out nodes by level (one lever a line)
: 说了pseudo code, 要求电面后email给他。
: 4. A database application is slow. How do you investigate the problem and
: how to improve it.
: Second 电面:
: 1. 写一个函数,输出一个整数里1-bit的数目。比如CountOneBits(7)应返回3。

h**********d
发帖数: 4313
9
明白了~谢谢

【在 M7 的大作中提到】
: Given some API functions:
: URLList getAllURLs(File input);
: File getFileFromURL(URL u);
: boolean containBadPhoneNumber(File input);
: 把这个想成一个tree traveral. 每个页面里的URL都是这个页面的children.
: 同时用一个URL hashtable来防止infinite loop.
: 差不多了吧?
:
: 后来
: hash

e******a
发帖数: 176
10
没看明白,能仔细说说么?
”最后我还是用了一个辅助的数据结构。他reply我,给了
idea. 实际上还是用两个static variable. 在recursion中计算,在foo(0)里面输出
F(X), 然后在recursion返回中在还原出F(X-1), F(X-2) …. 直到F(1), F(0).“

wc)
and

【在 M7 的大作中提到】
: First 电面:
: 1. 谈一下不同数据结构的优缺点。
: 2. 一个大文本文件里有电话号码。每行至多有一个号码。How do you process and
: return the total number of phone numbers. (in command line, use grep and wc)
: 3. A generic tree. how to print out nodes by level (one lever a line)
: 说了pseudo code, 要求电面后email给他。
: 4. A database application is slow. How do you investigate the problem and
: how to improve it.
: Second 电面:
: 1. 写一个函数,输出一个整数里1-bit的数目。比如CountOneBits(7)应返回3。

相关主题
进入JobHunting版参与讨论
s**********w
发帖数: 6
11
谢谢分享!
z*******0
发帖数: 30
12
int a;
int b;
int fibo1(int n)
{
if (n == 0) return 0;
if (n == 1 || n == 2) return 1;
a = 1; b = 1;
return fiboR(3, n);
};
int fiboR(int x, int n)
{
int c = a + b;
a = b;
b = c;
if (x == n)
{
cout < return b;
}
int v = fiboR(x+1, n);
cout < return v;
};

【在 e******a 的大作中提到】
: 没看明白,能仔细说说么?
: ”最后我还是用了一个辅助的数据结构。他reply我,给了
: idea. 实际上还是用两个static variable. 在recursion中计算,在foo(0)里面输出
: F(X), 然后在recursion返回中在还原出F(X-1), F(X-2) …. 直到F(1), F(0).“
:
: wc)
: and

c********t
发帖数: 5706
13
赞,如果要正序,就是把输出放在递归调用语句前面吧。
也就是说,不管正序还是逆序都要有两个static variables? 对吗?

【在 z*******0 的大作中提到】
: int a;
: int b;
: int fibo1(int n)
: {
: if (n == 0) return 0;
: if (n == 1 || n == 2) return 1;
: a = 1; b = 1;
: return fiboR(3, n);
: };
: int fiboR(int x, int n)

c******e
发帖数: 1032
14
Class A;
A a = u;
A a(u);
A a();<-
A a; <-
这两个有什么区别?
l*****a
发帖数: 14598
15
Fibonacci(0,1,k);
void Fibonacci(int a,int b,int k)
{
cout< if(k>1) Fibonacci(b,a+b,k-1);
return;
}
void Fibonacci(int a,int b,int k)
{
if(k>1) Fibonacci(b,a+b,k-1);
cout< return;
}
why need static variables?

【在 c********t 的大作中提到】
: 赞,如果要正序,就是把输出放在递归调用语句前面吧。
: 也就是说,不管正序还是逆序都要有两个static variables? 对吗?

1 (共1页)
进入JobHunting版参与讨论
相关主题
相关话题的讨论汇总
话题: int话题: fibonacci话题: return话题: fibor话题: 输出