这个周五 BestBuy 的 Lenovo Yoga 会出货,并且有比较大的折扣# PDA - 掌中宝
r*g
1 楼
直接从guangyi的总结里面的一个链接找的,但是链接没有答案,谢谢了
10. F(a, b) -> true or false means that person a knows person b. But it’
s not commutative, because person a can know person b, but b may not know a.
Say, you throw a party, you knows a number of people, invite them, then each
of them knows a bunch of people (those sets of people can intersect), so on
and so forth.
Now there is a celebrity comes in, everyone in the party knows him, but he
knows no one.
Write an algorithm effectively find out who the celebrity is.
这个题不是tree,不知道怎么找比较快。
13. Master mind guess.
Say a random 6-digit number is generated and hidden secretly.
Then there is a function: int Tell(int n); where the n is any 6-digit number
, and the function Tell returns how many of the digits are correct and in
the right position.
For example, if the secret is “123456”, and Tell(“523499”) -> 3
Now write an algorithm such that you can call Tell to figure out what is the
secret number efficiently.
这个题难道就是对每次变动每一位?这样岂不是开销比较大。
34. string/pattern matching. pattern can contain a-z and special chars
like "." and "*"
"." means matching any single char
"*" means matching zero or more chars of any kind.
string can contain a-z and "." "*". Note "." and "*" in string are just
regular chars, no special meanings.
这道题好像google出了很多次了,就是基于这样的字符怎么做匹配,谁能帮我考考古,
貌似这个版讨论过的。
谢谢了。
10. F(a, b) -> true or false means that person a knows person b. But it’
s not commutative, because person a can know person b, but b may not know a.
Say, you throw a party, you knows a number of people, invite them, then each
of them knows a bunch of people (those sets of people can intersect), so on
and so forth.
Now there is a celebrity comes in, everyone in the party knows him, but he
knows no one.
Write an algorithm effectively find out who the celebrity is.
这个题不是tree,不知道怎么找比较快。
13. Master mind guess.
Say a random 6-digit number is generated and hidden secretly.
Then there is a function: int Tell(int n); where the n is any 6-digit number
, and the function Tell returns how many of the digits are correct and in
the right position.
For example, if the secret is “123456”, and Tell(“523499”) -> 3
Now write an algorithm such that you can call Tell to figure out what is the
secret number efficiently.
这个题难道就是对每次变动每一位?这样岂不是开销比较大。
34. string/pattern matching. pattern can contain a-z and special chars
like "." and "*"
"." means matching any single char
"*" means matching zero or more chars of any kind.
string can contain a-z and "." "*". Note "." and "*" in string are just
regular chars, no special meanings.
这道题好像google出了很多次了,就是基于这样的字符怎么做匹配,谁能帮我考考古,
貌似这个版讨论过的。
谢谢了。