m******l 发帖数: 613 | 1 总共两轮,觉得第一轮的人态度好些
第一轮
millions of record, how to find the record with the smallest id. suppose
only 1000 records can be loaded into the memory.
第二轮
Fibonacci number
Give an integer X, how to find the biggest Fibonacci number smaller than
X?
Set theory,
Given two sets, how to find the union?
If they are two sorted integer arrays, how to find the union?
感想
我很容易紧张,第一个interviewer中途还安慰我来着。
但是读code超级影响速度,而且一定要反复check,不然人家可能把莫名其妙的code记录
上去 | g******d 发帖数: 511 | | I**A 发帖数: 2345 | 3 f(0)=1
f(1)=1
f(i) = f(i-1)+f(i-2)
generate the next fabonacci number until the next one is >= x, return the
current one?
【在 g******d 的大作中提到】 : 这题怎么答?
| y*********e 发帖数: 518 | 4 感谢分享。尝试做下题目。
millions of record, how to find the record with the smallest id. suppose
only 1000 records can be loaded into the memory. | f*****y 发帖数: 444 | 5 fibonacci 利用中间结果解很方便
// find a fib number that is just less then n
long found_fib(long n)
{
long a,b,temp;
a = 0;
b = 1;
while (b < n)
{
// a,b -> b, a+b
cout << b << " ";
temp = b;
b += a;
a = temp;
}
return a;
} | f*****y 发帖数: 444 | 6 fibonacci 利用中间结果解很方便
// find a fib number that is just less then n
long found_fib(long n)
{
long a,b,temp;
a = 0;
b = 1;
while (b < n)
{
// a,b -> b, a+b
cout << b << " ";
temp = b;
b += a;
a = temp;
}
return a;
} |
|