Forgot your password?
typodupeerror

Comment Re:I had an interview with Google a few weeks ago (Score 1) 458

Good challenge. BTW, you don't need 18 rounds, you need 17 because there's no need to check the floor 99 after you've checked 98. However, I believe you missed one important issue. In order for the solution to be efficient, it's not important how many rounds you do but how many floors you have to walk up and down. For example, if the right floor is 99, with your solution you'd have to do 17 rounds but walk up and down 1215 floors. With my solution, if I used both marbles (drop first, go up 3 floors, drop second, go down to pick them up), I'd do 18 rounds but walk up and down 983 floors. The difference gets more obvious in the lower floors. For example, if the floor 9 was the right one, you'd do 8 rounds and walk 45 floors, while I'd do just 3 rounds and walk 23 floors, etc.

Slashdot Top Deals

"We are on the verge: Today our program proved Fermat's next-to-last theorem." -- Epigrams in Programming, ACM SIGPLAN Sept. 1982

Working...