-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgetRandomTripplet()
More file actions
42 lines (27 loc) · 983 Bytes
/
getRandomTripplet()
File metadata and controls
42 lines (27 loc) · 983 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
2014-08-29
bluepp
May the force be with me!
http://www.mitbbs.com/article_t/JobHunting/32764727.html
Given a function
getRandomTripplet()
which returns a random triplet of letters from a string. You don't know the
string using calls to this function you have to correctly guess the string.
the length of the string is also given.
Lets say the string is helloworld the function getRandomTriplet will return
things like
hlo
hew
wld
owo
the function maintains the relative order of the letters. so it will never
return
ohl since h is before o in the string.
owe since w is after e
The string is not known you are only given length of the string.
据说是FB的phone interview
------------------
给你一个password 假定6位,
有个function 每call 一次就给你一个triplet 是password 里的随即三位,order不变
。比如google, 可能返回, ggl, goe, oog, ool, ........
问如何最有效破译这个密码,写code.