**Question:** A large group of zombies are coming towards you and there are three machine guns near you. Each machine gun has a different probability of firing bullets (say gun no 1 fires 1 bullet properly out of n bullets, on an average). You can operate one gun at a time and you do not know probability of firing bullets of any of the guns. What should be your strategy to attack zombies.

**Answer: **Since we do not know the probability of firing of any gun, we need to choose a gun randomly. We can fire certain number of bullets, lets say *n*, and estimate the probability of firing. We then switch to other guns, firing them *n* times, and estimate their probabilities of firing.

Let the estimated probabilities of three guns be *P _{1}*,

*P*and

_{2}*P*. Without loss of generality we can assume

_{3}*P*.

_{1}>= P_{2}>= P_{3}One strategy could be to use gun with probability *P _{1}* all the time. But since these are just estimated probability, on the basis of small sample set of size

*n*, true probabilities could be different and change our decision.

Higher the size of sample, *n*, more closer our estimated probabilities will be to the true probabilities. But if *n* is very large, we might waste too much time on inefficient guns.

A better strategy could be using Gun_{1} *100*P*_{1}*/(P*_{1}* + P*_{2}* + P*_{3}*)* percent times, Gun_{2} *100*P*_{2}*/(P*_{1}* + P*_{2}* + P*_{3}*)* percent times and Gun_{3} *100*P*_{3}*/(P*_{1}* + P*_{2}* + P*_{3}*)* percent times in a sample size of *3n*. After using all three guns we can update the probabilities P_{1}, P_{2}, P_{3} and use the updated probabilities to choose guns and continue switching the guns in similar manner.

Make sure you sign up at Prepleaf for regular quant and puzzle updates. Click here for more exciting puzzles.