未完成面试题

1. 一种字母游戏这样的
给定四个位置 _,_,_,_
然后每个位置可以选5个candidates,然后问这些candidates最多可以组成多少个有效
的词,字典是给定的。

比如,
如果字典是 [cake, bike, fake]
我们可以这样选candidates
第一个位置可以选 b,c,f,e,d
第二个位置 i,a,o,p,e
第三个位置 k,m,w,q,a
第四个位置 e,g,h,k,l
那这些可以组成3个有效的词 cake, bike, fake.

但是如果,这样选每个位置的candidates
第一个位置可以选 z,c,v,b,y
第二个位置 i,a,o,p,e
第三个位置 k,m,w,q,a
第四个位置 e,g,h,k,l

只能组成一个有效的词就是bike.
这样就是第一种选candidates的方法比较好。

2. 设计一个类来限制query,如1000qps,或者说每秒钟只能发10封邮件
给定的API,now()返回当前milliseconds
实现类的函数allowRequest(),如果当前还有request剩余true,否则返回false

http://www.mitbbs.com/article_t/JobHunting/32801007.html

3. Given a doubly linked list, besides the next and previous pointers, each
element has a child pointer, which may or may not point to a separate doubly
linked list. These child lists may have one or more children of their own.
Now do the following:

a. Flattern this multilevel data structure
b. Restore the original structure from the flatterned structure

e.g.

L1 --> L2 --> L3 --> L7 --> L8
|
v
L4 --> L5-->L6


WIll be flattened to
L1 --> L2 --> L3 -->L4 -->L5-->L6-->L7-->L8

http://www.mitbbs.com/article_t/JobHunting/32728009.html

原文地址:https://www.cnblogs.com/linyx/p/4019193.html