Tuesday, June 17, 2014

Given n coupons, how many coupons do you expect you need to draw with replacement before having drawn each coupon at least once ?

Alternatively Suppose that there is an set of n different coupons, from which coupons are being collected, equally likely, with replacement. What is the probability that more than t sample trials are needed to collect all n coupons ? 

Thursday, November 14, 2013

5 pirates of different ages have a treasure of 100 gold coins puzzle

5 pirates of different ages have a treasure of 100 gold coins. 

On their ship, they decide to split the coins using this scheme: 

The oldest pirate proposes how to share the coins, and ALL pirates (including the oldest) vote for or against it. 

If 50% or more of the pirates vote for it, then the coins will be shared that way. Otherwise, the pirate proposing the scheme will be thrown overboard, and the process is repeated with the pirates that remain.

As pirates tend to be a bloodthirsty bunch, if a pirate would get the same number of coins if he voted for or against a proposal, he will vote against so that the pirate who proposed the plan will be thrown overboard.

Assuming that all 5 pirates are intelligent, rational, greedy, and do not wish to die, (and are rather good at math for pirates) what will happen?

Tuesday, November 12, 2013

2 Boys and train puzzles

Suppose 2 boys are walking in the woods and they decide to take a shortcut through a railroad tunnel. They had walked 2/3 of the way through the tunnel, but then something horrible happened: a train was coming in the opposite direction towards the 2 boys, and it was coming close to the other entrance of the tunnel. Each boy ran in a different direction to get out of the tunnel and avoid the incoming train. Each boy ran at the same exact speed of 10 miles per hour, and each boy managed to escape the train at the exact instant in which the train would have hit and killed him. If the train was moving at a constant speed and each boy was capable of instantaneous acceleration, then how fast was the train going?

Wednesday, October 16, 2013

Determine winner of 2/9 number game

Two players play the following game: they pick a random number N (less than 2 billion) then, 
starting from 1, take turns multiplying the number from the previous turn with either 2 or 9 (their choice). Whoever reaches N first wins. 
The candidate should write a function that given N decides who wins (first or second player)?

Friday, July 26, 2013

What strategy should be used to kill the fewest dwarfs, and what is the minimum number of dwarfs that can be saved with this strategy?

A dwarf-killing giant lines up 10 dwarfs from shortest to tallest. Each dwarf can see all the shortest dwarfs in front of him, but cannot see the dwarfs behind himself. The giant randomly puts a white or black hat on each dwarf. No dwarf can see their own hat. The giant tells all the dwarfs that he will ask each dwarf, starting with the tallest, for the color of his hat. If the dwarf answers incorrectly, the giant will kill the dwarf. Each dwarf can hear the previous answers, but cannot hear when a dwarf is killed. What strategy should be used to kill the fewest dwarfs, and what is the minimum number of dwarfs that can be saved with this strategy?

Source: http://www.businessinsider.com/toughest-job-interview-questions-2013-7?op=1#ixzz2a9upxPNJ