在SCB面试的一道概率题当时虽然给了答案...但是比较慢,谁有更快的解答?
toss a fair coin, what is the expected number of tosses to
get 2 consecutive heads?
答案看来是6
darkart@darkart-laptop:~/workspace$ java tt 10
5.3
darkart@darkart-laptop:~/workspace$ java tt 100
5.12
darkart@darkart-laptop:~/workspace$ java tt 1000
5.977
darkart@darkart-laptop:~/workspace$ java tt 10000
6.0389
darkart@darkart-laptop:~/workspace$ java tt 100000
6.01165
darkart@darkart-laptop:~/workspace$ java tt 1000000
5.997272
darkart@darkart-laptop:~/workspace$ java tt 10000000
6.0009894
5.3
darkart@darkart-laptop:~/workspace$ java tt 100
5.12
darkart@darkart-laptop:~/workspace$ java tt 1000
5.977
darkart@darkart-laptop:~/workspace$ java tt 10000
6.0389
darkart@darkart-laptop:~/workspace$ java tt 100000
6.01165
darkart@darkart-laptop:~/workspace$ java tt 1000000
5.997272
darkart@darkart-laptop:~/workspace$ java tt 10000000
6.0009894