真诚找个男朋友# gardening - 拈花惹草
s*f
1 楼
日子久了,忘了一些。搅拌到一起,无公司名。有些板上看见过的不列了,呵呵
注意编码,很难得算法不咋会考。
1.实现BigInt类。实现 ‘+’ 即可。
2.国际象棋棋盘中两个queen之间最短路径(queen只能斜着走),返回步数即可。就是
一个queen最少几步能走到另一个queen
3.class SortedArrays{
listofSortedArrays;
public:
bool HasNext();
bool Next();
}
1,3 ..
2,5 ..
4,5 ...
--> 1,2,3,4,5,5....
4. // return a^b
// pow(2, 3) = 8;
// pow(2, -3); = 1 / 8;
// if a < 0;
double pow(double a, int b){
5. binary search in sorted, but head-in-middle array. [15, 16, 1, 3, 9, 11,
13]
6. 1boogle game. give a boogle and a word, return whether the word in the
boogle (somewhat like 老鼠走迷宫,but have key difference)
7. 罗马数字转阿拉伯数字
9. 一些分布式系统的设计
10. 存取二叉树
11. 排列组合算法
12. 一个整数数组a,一个数字n, 从a中取出0到len(a)个数,如果有和为n的组合,
return true.
13. 把数组中所有的0挪到最后。
14. giving 1 big buffer, how to design 10 queues, so that the space can be
used efficiently.
15. 存储系统,cloud(dropbox)的设计
16. 判断链表有没有环,还要找到那个乱指回去的点! 不是交点,是那个乱指的点,
它指向交点。
17. 一个数组,里面的每一项都有出现的概率,实现randompick(),按概率返回随机
的一项。suppose u have array:
apple 16516
obama 5616
geek 416
.....
u can think it as (query, frequency), for example.
now u need to randomly pick a query in this array, that is, the probability
of picking "apple" is about 3 times of the probability of picking "obama"
注意编码,很难得算法不咋会考。
1.实现BigInt类。实现 ‘+’ 即可。
2.国际象棋棋盘中两个queen之间最短路径(queen只能斜着走),返回步数即可。就是
一个queen最少几步能走到另一个queen
3.class SortedArrays{
listofSortedArrays;
public:
bool HasNext();
bool Next();
}
1,3 ..
2,5 ..
4,5 ...
--> 1,2,3,4,5,5....
4. // return a^b
// pow(2, 3) = 8;
// pow(2, -3); = 1 / 8;
// if a < 0;
double pow(double a, int b){
5. binary search in sorted, but head-in-middle array. [15, 16, 1, 3, 9, 11,
13]
6. 1boogle game. give a boogle and a word, return whether the word in the
boogle (somewhat like 老鼠走迷宫,but have key difference)
7. 罗马数字转阿拉伯数字
9. 一些分布式系统的设计
10. 存取二叉树
11. 排列组合算法
12. 一个整数数组a,一个数字n, 从a中取出0到len(a)个数,如果有和为n的组合,
return true.
13. 把数组中所有的0挪到最后。
14. giving 1 big buffer, how to design 10 queues, so that the space can be
used efficiently.
15. 存储系统,cloud(dropbox)的设计
16. 判断链表有没有环,还要找到那个乱指回去的点! 不是交点,是那个乱指的点,
它指向交点。
17. 一个数组,里面的每一项都有出现的概率,实现randompick(),按概率返回随机
的一项。suppose u have array:
apple 16516
obama 5616
geek 416
.....
u can think it as (query, frequency), for example.
now u need to randomly pick a query in this array, that is, the probability
of picking "apple" is about 3 times of the probability of picking "obama"