Showing posts with label Microsoft Puzzle. Show all posts
Showing posts with label Microsoft Puzzle. Show all posts

Saturday, May 14, 2011

Which Box Has Defective Balls

You have 10 boxes of balls (each ball weighing exactly10 gm) with one box with defective balls (each one of the defective balls weigh 9 gm). You are given an electronic weighing machine and only one chance at it. How will find out which box has the defective balls?



Firstly 10 boxes of ball kept in a queue and mark it as box1,box2,box3.........box10
then from 1st box we have to take 1 ball,from 2nd box 2 ball..........from 10th box we kept 10 balls. and weight the total ball....

so if total nos ball is :n(n+1)/2 (n= total nos of box that is 10)=55
if all the ball is 10 gm.then total weight will be=550gm.
suppose total weight is 546gm.
so the difference is(550-546=4gm).
then the d defective ball is in box no:4.
similarly we can try for all possible box difference gives us the box number which contains the defective balls

Monday, April 11, 2011

9 Digit Number Problem Every nth number formed by n digit is Divided By Every nth digit

Arrange the digits 0 to 9 such, that the number formed by the
first digit is divisible by 1, the number formed by the first two
digits is divisible by 2, that formed by the first three digits
divisible by 3, and so forth, thus the number formed by the first
9 digits will be divisible by 9 and that formed by all 10 digits
divisible by 10.

Here is what we would do.

_ _ _ _ _ _ _ _ _ _

those are my ten blanks.

Now let's start asking questions.

Since the whole thing has to be divisible by 10, the last number
must be a zero.

And since the first five digits must be divisible by 5, the fifth
digit must be a 5 or 0, but we have already used 0 so it must be a
five.

One last quickie is that the 2nd, 4th, 6th, and 8th and last
digits must be even, so all the rest are odd

So let's look at we have. I'll write the digits that could go in a
certain place under where they could go:


_ _ _ _ 5 _ _ _ _ 0
1 2 1 2 2 1 2 1
3 4 3 4 4 3 4 3
7 6 7 6 6 7 6 7
9 8 9 8 8 9 8 9

Now things get trickier.

Let's start with the 4th spot.

Any number is divisible by 4 if the last two digits are divisible
by 4

So what are the two-digit numbers divisible by 4 that begin with
an odd number that is not 5?

12 16 32 36 72 76 92 96

Hey, so the 4th digit is either a 2 or a 6.

Now, let's look at the 8th digit. If the first 8 digits are
divisible by 8, then they are divisible by 4 also. So if we apply
the same logic as above, we find that the 8th digit is either a 2 or
a 6.

So spaces 2 and 6 must be 4 or 8.

That narrows it down. So we have this:

_ _ _ _ 5 _ _ _ _ 0
1 4 1 2 4 1 2 1
3 8 3 6 8 3 6 3
7 7 7 7
9 9 9 9



Now for my next trick let's recall that every third space must be
divisible by 3. So every three numbers must sum to be divisible
by 3.

In particular spaces 4, 5, and 6 must sum to 3, and we already
have a five. So either we have

2 5 8 or 6 5 4

in positions 4, 5, and 6.

That is good stuff. That means we have either this:

_ 4 _ 2 5 8 _ 6 _ 0
1 1 1 1
3 3 3 3
7 7 7 7
9 9 9 9

or this:

_ 8 _ 6 5 4 _ 2 _ 0
1 1 1 1
3 3 3 3
7 7 7 7
9 9 9 9

Let's check each of the four digits we could put in the 8th place.
Since a number is divisible by 8 if its last 3 digits are, we need
number in the 6th, 7th, and 8th places to be divisible by 8. We see
that 816 and 896 work in the first case, and 432 and 472 work in the
second case. So we have:

_ 4 _ 2 5 8 _ 6 _ 0
1 1 1 1
3 3 9 3
7 7 7
9 9 9

or this:

_ 8 _ 6 5 4 _ 2 _ 0
1 1 3 1
3 3 7 3
7 7 7
9 9 9


Let's look at the 9th place now. Recall that 1+2+3+4+5+6+7+8+9 = 45,
so we don't need to worry about the 9th place - it will always work
out.

Let's look at the 1st and 3rd places. In case 1, only 147 and 741 are
options. In case 2, we could have 183, 189, 381, 387, 783, 789, 981, or
987. Note that 387 and 783 don't work, because then we don't have any
digits left for the 7th digit.

So our first case becomes:

_ 4 _ 2 5 8 9 6 3 0
1 1
7 7

We can just check the two numbers this can give rise to, namely 1472589630
and 7412589630. Since neither of them are divisible by 7, case one must be
a dead end. So we have to work with case two if we want a solution:

_ 8 _ 6 5 4 _ 2 _ 0
1 1 3 1
3 3 7 3
7 7 7
9 9 9

(and the first 3 digits are 183, 189, 381, 789, 981, or 987)

If we look at the 7th, 8th, and 9th digits to see if we can get them to sum
to three, we see that only 321, 327, 723, and 729 are options.

So which of our options for digits 1,2,3 and 7,8,9 can we use together? In
order to not repeat digits, we could use these:

183 and 729
189 and 327
189 and 723
381 and 729
789 and 321
981 and 327
981 and 723
987 and 321

This means that the only possible solutions to the puzzle are these:

1836547290
1896543270
1896547230
3816547290
7896543210
9816543270
9816547230
9876543210

This is now a small enough number of cases that we can check them by hand.
The first thing we should do is check the first 7 digits for divisibility by
seven. Here are the results:

1836547/7 = 262363.857142857...
1896543/7 = 270934.714285714...
1896547/7 = 270935.285714286...
3816547/7 = 545221
7896543/7 = 1128077.57142857...
9816543/7 = 1402363.28571429...
9816547/7 = 1402363.85714286...
9876543/7 = 1410934.71428571...

Saturday, April 2, 2011

6 Riddles

QUESTIONS:

1) The Elder Twin
One day Kerry celebrated her birthday. Two days later her older twin brother, Terry, celebrated his birthday.
How could this happen?

2) Manhole Covers
Why is it better to have round manhole covers than square ones?

This is logical rather than lateral, but it is a good puzzle which can be solved by lateral thinking techniques. It is supposedly used by a very well-known software company as an interview question for prospective employees.

3) The Deadly Party
A man went to a party and drank some of the punch. He then left early. Everyone else at the party who drank the punch subsequently died of poisoning.
Why wasn't the first guy poisoned?

4) Heaven
A man died and went to Heaven. There were thousands of other people there. They were all naked and all looked as they died at the age of 21. He looked around to see if there was anyone he recognized. He saw a couple and he knew immediately that they were Adam and Eve.
How did he know?

5) Trouble with Sons
A woman had two sons who were born on the same hour of the same day of the same year. But they were not twins.
How could this be so?

6) The Man in the Bar
A man walks into a bar and asks the barman for a glass of water. The barman pulls out a gun and points it at the man. The man says `Thank you' and walks out.
Why?

This puzzle has claims to be the best of the genre. It is simple in its statement, absolutely baffling and yet with a completely satisfying solution. Most people struggle very hard to solve this one yet they like the answer when they hear it or have the satisfaction of figuring it out.





ANSWERS:

1) At the time she went into labor, the mother of the twins was traveling by boat. The older twin, Terry, was born first early on March 1st. The boat then crossed the International Date line (or anytime zone line) and Kerry, the younger twin, was born on February the 28th. In a leap year the younger twin celebrates her birthday two days before her older brother.

2) A square manhole cover can be turned and dropped down the diagonal of the manhole. A round manhole cannot be dropped down the manhole. So for safety and practicality, all manhole covers should be round.

3) The poison in the punch came from the ice cubes. When the man drank the punch the ice was fully frozen. Gradually it melted, poisoning the punch.

4) He recognized Adam and Eve as the only people without navels. Because they were not born of women, they had never had umbilical cords and therefore they never had navels.

This one seems perfectly logical but it can sometimes spark fierce theological arguments!

5) They were two of a set of triplets (or quadruplets etc.)

This simple little puzzle stumps many people. They try outlandish solutions involving test-tube babies or surrogate mothers. Why does the brain search for complex solutions when there is a much simpler one available?

6) The man had hiccups. The barman recognized this from his speech and drew the gun in order to give him a shock. It worked and cured the hiccups - so the man no longer needed the water.

The is a but a difficult one to solve. It is a perfect example of a seemingly irrational and incongruous situation having a simple and complete explanation. Amazingly this classic puzzle seems to work in different cultures and languages.

Wednesday, March 30, 2011

Weigh System With More Explaination..How Many Weight We Needs..???

Puzzle: You have a common balance with two sides. You can only keep weighs on one side. You have to weigh items from 1 to 1000 weight units with integral weights only.
What is the minimum number of weights required and what will be their weights?
Eg. With 2 weights one of 1 weight unit and other of 3 weight unit you can measure 1, 3 and 4 only.
Note: Don't forget to visit us again. Answer to the puzzle will be posted tomorrow. You can provide your answer in comments.

Solution: This puzzle is an easy puzzle as to make any odd number you need all other even numbers and one 1.
So only one odd number is needed to make all odd numbers. Now you are left with all even numbers. All even numbers are base 2 and thus can be though of as binary representation. To make 1000 you need at most 10 bits(1111101000). You can make any number below 1000 from these bits.
So the answer is 10 weights required. 1, 2, 4, 8,16, 32, 64, 128, 256, 512.

Puzzle: This is part 2 of puzzle posted Above. The puzzle is that you have to weigh 1 to 1000 using a common balance scale with minimum number of weighs. This time you can put wights on both sides.
You can check Part 1 of this puzzle How many weights? Puzzle Part 1.
Note: Don't forget to visit us again. Answer to the puzzle will be posted tomorrow with winner's name. You can provide your answer in comments.

Solution: The answer is series of base 3 i.e. 1, 3, 9, 27, 81, 243 and 729.
We can start from smallest number 1. To measure 1 we definitely need 1.
To measure 2 we need to look for highest number possible. We can measure 2 by using 3(3-1 = 2). So we need 1 and 3.
Now to measure 4 we can use 1 and 3 both (1+ 3). To measure 5 again we will look for highest possible number. 9 is highest possible number (9-4 = 5). We can measure up to 13 using these weights.

Continuing the same way we can deduce that a series of base 3 is required, thus 1, 3, 9, 27, 81, 243, 729.


Puzzle: This is the 3rd part of weighing puzzles. You can check Part 2 and Part 1.
You have to weigh 125 packets of sugar with first one weighing 1 lb, second 2 lb, third 3 lb and so on.You can only use one pan of the common balance for measurement for weighing sugar, the other pan has to be used for weights.
The weights have to put on to the balance and it takes time. Time taken to move weights is equal to the number of weights moved.
Eg. So if you are weighing 5 lb using 3lb and 2 lb weight then you have to lift both these weights one by one and thus it will take 2 unit time. If you have to measure only 3lbs it will take only 1 unit time. Now if we have to measure sugar packets of weights 1,3,4 using weights 1 and 3 only. For this first we measure 1 lb, with 1 unit of time, we place 3 lb along with 1 lb and measure 4kg with again 1 unit of time, and finally we move 1kg out of pan to measure 3kg in 1 unit of time. So in 3 units of time we could measure 1,3 and 4lb using weights 1 and 3 only.

Now you have to make sugar packets of all weights from 1 to 125 in minimum time, in other words in minimum movement of weights. The question here is to find out the minimum number of weighs needed and the weight of each the weights used and the strategy to be followed for the creation of 125 packets of sugar.
Note: Don't forget to visit us again. Answer to the puzzle will be posted tomorrow with winner's name. You can provide your answer in comments.
Source: Classic Puzzles
Solution: Amazing explanation provided by Kasturi.
You will need the weights 1, 2, 4, 8, 16, 32 and 64 i.e. 7 weights. You can measure 125 packets in 125 movements. The strategy to be followed is this:
Put 1: measure 1, weights in pan 1

To measure further you need to use a new weight.
Put 2: measure 3, weights in pan 1,2
Remove 1: measure 2, weights in pan 2

Thus, by adding the next smallest weight to the pan i.e. 2, we can measure all weights below 4 in total 3 movements.

To measure further you need to use a new weight.
Put 4: measure 6, weights in pan 2,4
Remove 2: measure 4, weights in pan 4
Put 1: measure 5, weights in pan 1,4
Put 2: measure 7, weights in pan 1,2,4

Thus, by adding the next smallest weight to the pan i.e. 4, we can measure all weights below 8 in total 7 movements.

Following the same strategy, whenever we have measured all weights below n, add n and we can measure measure all the weights below 2n in 2n-1 movements.
Eventually, we can measure 125 packets in 125 movements.

Thursday, March 24, 2011

Aeroplane In Iseland Puzzle

The puzzle question is : On Bagshot Island, there is an airport. The airport is the homebase of an unlimited number of identical airplanes. Each airplane has a fuel capacity to allow it to fly exactly 1/2 way around the world, along a great circle. The planes have the ability to refuel in flight without loss of speed or spillage of fuel. Though the fuel is unlimited, the island is the only source of fuel.
What is the fewest number of aircraft necessary to get one plane all the way around the world assuming that all of the aircraft must return safely to the airport? How did you get to your answer?
Notes:
(a) Each airplane must depart and return to the same airport, and that is the only airport they can land and refuel on ground.
(b) Each airplane must have enough fuel to return to airport.
(c) The time and fuel consumption of refueling can be ignored. (so we can also assume that one airplane can refuel more than one airplanes in air at the same time.)
(d) The amount of fuel airplanes carrying can be zero as long as the other airplane is refueling these airplanes. What is the fewest number of airplanes and number of tanks of fuel needed to accomplish this work? (we only need airplane to go around the world)


As per the puzzle given ablove The fewest number of aircraft is 3! Imagine 3 aircraft (A, B and C). A is going to fly round the world. All three aircraft start at the same time in the same direction. After 1/6 of the circumference, B passes 1/3 of its fuel to C and returns home, where it is refuelled and starts immediately again to follow A and C.

C continues to fly alongside A until they are 1/4 of the distance around the world. At this point C completely fills the tank of A which is now able to fly to a point 3/4 of the way around the world. C has now only 1/3 of its full fuel capacity left, not enough to get back to the home base. But the first "auxiliary" aircraft reaches it in time in order to refuel it, and both "auxiliary" aircraft are the able to return safely to the home base.

Now in the same manner as before both B and C fully refuelled fly towards A. Again B refuels C and returns home to be refuelled. C reaches A at the point where it has flown 3/4 around the world. All 3 aircraft can safely return to the home base, if the refuelling process is applied analogously as for the first phase of the flight.

Tuesday, March 22, 2011

Measure ( Minutes With two SandGlasses of 4 MInutes & 7 Minutes

If you have two sand glasses One of them is for the 4 minute another one - is for 7 minutes If you have to measure 9 minutes with these two sand glasses in 9 minutes?

At 0 minutes, turn both the hourglasses.

After 4 minutes:
The 4 minute hourglass: 0 minutes left.
The 7 minute hourglass: 3 minutes left.
Turn the 4 minute hourglass.
After 7 minutes:
The 4 minute hourglass: 1 minute left.
The 7 minute hourglass: 0 minutes left.
Turn the 7 minute hourglass.

After 8 minutes:
The 4 minute hourglass: 0 minutes left.
The 7 minute hourglass: 1 minute left.
Turn the 7 minute hourglass.

After 9 minutes:
The 4 minute hourglass: 0 minute left.
The 7 minute hourglass: 0 minutes left.

Now you know you are finished.

Thursday, March 10, 2011

Two Creepers Climbing a Tree

Two creepers, one jasmin and other rose, are both climbing up and round a cylindrical tree trunk. jasmine twists clockwise and rose anticlockwise, both start at the same point on the ground. before they reach the first branch of the tree the jasmine had made 5 complete twists and the rose 3 twists. not counting the bottom and the top, how many times do they cross?

The first thing to realise is the vertical aspect of the puzzle is something of an illusion. For convenience we will proceed as if they both travel vertically at the same speed and thus complete the journey in the same unspecified time Ttotal, but this is for convenience regardless of the times the path described is the same.

From here we may now consider their motion as being constrained to the outer edge of a circle in the horizontal plane. The problem now becomes not dissimilar to a puzzle involving the overlap of the hands of a clock, though of course the hands are moving in opposite directions.

Each of the creepers will have speeds 5w and 3w. Where 'w' is some unspecified angular velocity in degrees per second, although the units are arbitrary. Using speed is distance over time or time = distance / speed, knowing that the total distance travelled 360 degrees times 5 revolutions or 3 revolutions we can easily show Ttotal as a function of w. Ttotal = 360 * 5 / (5w) or Ttotal = 360 * 3 / (3w) hence Ttotal = 360 / w. We will need this later.

The First Coincidence

We now have two motions around a circle starting at one point, travelling in opposite directions, with speeds 3w and 5w. We need to solve this for time.
jasmine and rose creepers puzzle
Ama



We know a total distance of 360 degrees is travelled by two objects with speeds 5w and 3w. Our equations of motion give us:

360=5wt + 3wt = 8wt
t = 360 / 8w

So our first overlap is at t = 360 / 8w. In terms of subsequent overlaps the puzzle is in some ways reset. They are co-existent at this time and travelling in opposite directions. if we were to calculate the next time of overlap it would be the same. We now know an overlap occurs every 360 / 8w

Total Coincidence

An overlap occurs every 360 / 8w for a time of Ttotal = 360 / w hence the number of coincidence is

Ttotal / time between coincidence
(360 / w) / (360 / 8w)
8

since the division is exact we know that the last coincidence is at t = Ttotal, hence there are 7 overlaps not including the top and bottom.

Source : puzzles.nigelcoldwell.co.uk/thirtytwo.htm

Wednesday, March 9, 2011

Odd Ball & Weighing System Puzzle ..A Good Puzzle

You have 12 balls with you out of which one ball is either lighter or heavier than the rest of the balls which are of the same weight. You have a weighing scale with you and are allowed to use it three times. How can you find out which ball is the odd one and also if it is lighter or heavier than the rest?



Number the balls 1 to 12. Weigh 1, 2, 3, and 4 against 5, 6, 7, and 8.
If (1, 2, 3, 4) and (5, 6, 7, 8) balance:
Weigh 9 and 10 against 11 and 8 (we know 8 is not the odd ball).
If (9, 10) and (11, 8) balance: then 12 is the odd one.

Weigh 12 against any other to find out if it is heavy or light.

If (9, 10) and (11, 8) do not balance: suppose 11 and 8 are heavier,
than 9 and 10; then either 11 is heavy, or 9 is light, or 10 is light.

Weigh 9 against 10; if they balance, 11 is heavy; if they do not,
the lighter of 9 and 10 is the odd ball.

(Similar argument if 11 and 8 are lighter than 9 and 10).

If (1, 2, 3, 4) and (5, 6, 7, 8) do not balance:
Suppose 5, 6, 7, and 8 are heavier than 1, 2, 3, & 4. Then: one of
(1, 2, 3, or 4) is light, or else one of (5, 6, 7, or 8) is heavy.
Weigh 1, 2, and 5 against 3, 6, and 9.
If they balance: then either 7 is heavy, or 8 is heavy, or 4 is light.
Weigh 7 against 8; if they balance, 4 is the odd ball, otherwise the
heavier of 7 and 8 is the odd ball.

If (1, 2, 5) and (3, 6, 9) do not balance: suppose 1, 2, and 5 are lighter
than 3, 6, and 9; then either 6 is heavy, or 1 is light, or 2 is light.
Weigh 1 against 2 to find out which one of the three choices is true.
Otherwise, suppose 1, 2, and 5 are heavier than 3, 6, and 9; then either 3
is light, or 5 is heavy.

Weigh 3 against (say) 2 to find out which of the two choices is true.

(Similar argument if 1, 2, and 5 are lighter than 3, 6, and 9).

Friday, February 25, 2011

Number, Reminder & Mystery

There is a number N

If N is divided by 7 the remainder is 1, it can be shown as mod operator.

N%7=1

N%9=2

N%11=3

What is N?


the way to find the answer is the trail and error method. for that start with the 7 .check the 7+1 =8, 7*7+1=50, and 7*7*7+1=344. check the number 344 with 9 and 11 it gives the remainders 2 and 3 respectively. so 344 is the one of the required number . to calculate the remaining numbers the formula is lcm(7,9,11)*any real number + 344.
so the answer is the numbers 693*x+344. where x=0,1,2,……

BBoxes & N Dollers

“You have b boxes and n dollars. If I want any amount of money from 0 to n dollars, you must be able to hand me 0 to b boxes so that I get exactly what I request.” The two questions were “What are the restrictions on b and n, and how is money distributed among the boxes?”



The trick is of Binary Numbers
2^0=1
2^1=2
2^2=4
2^3=8
2^4=16
….


2^7=128


..

The formula is [log n to base 2] + 1 = b e.g b=logn+1 with base 2
where [] denote integral part of the log base 2 of n

Example
So if we want 0 to 15 dollars
[log of 15 to base 2] + 1 = [3.90] + 1 = 3 + 1 = 4 boxes
we need to have 4 boxes each having 1,2,4,8, dollars respectively.Now we know from binary numbers that any amount from 0 to 15 can be formed with this boxes.

For 0 to 6 dollars
[log of 7 to base 2] + 1 = [2.58] + 1 = 2 + 1 = 3 boxes
we need to have 3 boxes each having 1,2,4, dollars respectively

For 0 to 100 dollars
[log of 100 to base 2] + 1 = [6.64] + 1 = 6 + 1 = 7 boxes
we need to have 7 boxes each having 1,2,4,8,16,32,64 dollars respectively

Correct me if Anything wrong

Wednesday, February 16, 2011

Fairness in Carpooling

A group of n people decide to form a carpool. Each day a subset of these people will arrive to a (fixed) gathering point and one of them should drive. A method for determining which person should drive on any given day is required. The algorithm should be perceived as fair by all members so as to encourage their continued participation. Before discussing the scheduling algorithm, suggest a criterion for fairness

Comparing Information Without Leaking It

Bob comes to Ron, a manager at his company, with a complaint about a sensitive matter; he asks Ron to keep his identity confidential. A few months later, Moshe (another manager) tells Ron that someone has complained to him, also with a confidentiality request, about the same matter.

Ron and Moshe would like to determine whether the same person has complained to each of them, but, if there are two complainers, Ron and Moshe want to give no information to each other about their identities.

The protocol typically used in a situation like this one is akin to the game ``twenty questions,'' but goes by the name of ``delicate conversational probing.'' Ron might ask Moshe if Moshe's complainer is male, and if the answer is ``yes'' Moshe might then ask Ron if Ron's complainer's surname begins with a letter preceding ``M'' in the alphabet. This goes on until Ron and Moshe have ascertained whether they have the same person in mind. When they do not, however (particularly when the first ``no'' occurs late in the game) a great deal of information may have been exchanged.

What can Ron and Moshe do in order not leak more information than necessary?

The Circular Lake

A swan sits at the center of a perfectly circular lake. At an edge of the lake stands a ravenous monster waiting to devour the swan. The monster can not enter the water, but it will run around the circumference of the lake to try to catch the swan as soon as it reaches the shore. The monster moves at 4 times the speed of the swan, and it will always move in the direction along the shore that brings it closer to the swan the quickest. Both the swan and the the monster can change directions in an instant.

The swan knows that if it can reach the lake's shore without the monster right on top of it, it can instantly escape into the surrounding forest.

How can the swan succesfully escape?

Flipping Lockers

There are 1 million closed school lockers in a row, labeled 1 through 1,000,000.

You first go through and flip every locker open.

Then you go through and flip every other locker (locker 2, 4, 6, etc...). When you're done, all the even-numbered lockers are closed.

You then go through and flip every third locker (3, 6, 9, etc...). "Flipping" mean you open it if it's closed, and close it if it's open. For example, as you go through this time, you close locker 3 (because it was still open after the previous run through), but you open locker 6, since you had closed it in the previous run through.

Then you go through and flip every fourth locker (4, 8, 12, etc...), then every fifth locker (5, 10, 15, etc...), then every sixth locker (6, 12, 18, etc...) and so on. At the end, you're going through and flipping every 999,998th locker (which is just locker 999,998), then every 999,999th locker (which is just locker 999,999), and finally, every 1,000,000th locker (which is just locker 1,000,000).

At the end of this, is locker 1,000,000 open or closed?

Prisoners and a Lightbulb

There is a prison with 100 prisoners, each in separate cells, which are sealed off, soundproof and windowless. There is a lobby in the prison with a lightbulb in it. Each day, the warden will pick one of the prisoners at random (even if they have been picked before) and take them out to the lobby. The prisoner will have the choice to flip the lightbulb switch if they want. The lightbulb starts in the "off" position.

When a prisoner is brought out to the lobby, he also has the option of saying "Every other prisoner has been brought out to the lobby." If a prisoner chooses to say this and it is true, all the prisoners will go free. However, if a prisoner chooses to say this and it's wrong, all the prisoners will be executed. So a prisoner should only say this if he knows it is true for sure.

Before the first day of this process begins, all the prisoners are allowed to get together to discuss a strategy to eventually save themselves.

What strategy could they use to ensure their eventual salvation?

Quick Bridge-Crossing

Four people come to an old bridge in the middle of the night. The bridge is rickety and can only support 2 people at a time. The people have one flashlight, which needs to be held by any group crossing the bridge because of how dark it is.

Each person can cross the bridge at a different rate: one person takes 1 minute, one person takes 2 minutes, one takes 5 minutes, and the one person takes 10 minutes. If two people are crossing the bridge together, it will take both of them the time that it takes the slower person to cross.

Unfortunately, there are only 17 minutes worth of batteries left in the flashlight. How can the four travellers cross the bridge before time runs out?

The Prisoners' Boxes

You are the janitor at a prison with 100 prisoners locked in separate, soundproof and windowless cells.

You watch one day as the warden brings the prisoners out to a central room where there are 100 boxes laid out, labeled 1 through 100. He hands each prisoner a slip of paper and a pen, and asks everyone to write their name on their slip and hand it back to him. All the prisoner's have different names.

The warden then makes a proposition to the prisoners. He will put them back in their cells and will put each of the 100 slips of paper into a different box. The prisoners will then be brought out one by one in a random order. When a prisoner comes out, he will get to open 50 boxes. He doesn't need to preselect which boxes he'll open; he can choose as he goes along. He is also not allowed to rearrange the boxes or the names as he does this.

If any of the 50 boxes he opens contains the slip with that prisoner's name on it, then that prisoner "passes" the test. He will be sent back to his cell, all of the boxes will be closed, and the next prisoner will be brought out. However, if any prisoner opens 50 boxes and none of them contain his name, then all 100 prisoners will be executed. Note that prisoners have no way of passing information on to any of the prisoners who go after them.

If all of the prisoners are able to "pass" the test, then they will all be set free, and you'll receive a big promotion.

Luckily for the prisoners, the warden is going to let you help them in the following way. After he's put all of the names in the boxes, he will bring you into the room, let you look at all the names in all the boxes, and then, if you choose to, switch two names with each other. For example, you could switch the names in boxes 35 and 77. You are only allowed to make one switch.

After you help with this task, you will be sent out of the prison and will not be able to communicate with the prisoners.

Before this strange game begins, you get to meet with the prisoners to discuss a strategy. This strategy must have two parts:

  1. How do you decide which names to switch, if any at all?
  2. How does each prisoner decide which 50 boxes he will open?

What plan do you come up with to ensure that the prisoners will all go free?

Drunken Passanger

100 Airlines passenger are standing in a queue to board a plane. They each hold a ticket to one of the 100 seats in that flight (n’th passenger in the queue hold the ticket for seat # n). First passenger is drunk, and he picks a random seat and sit on it.

All the other passengers go inside one-by-one and occupy seats according to the below logic

  • Each passenger will occupy its own seat, if its seat is not already occupied by another.
  • If its seat is occupied by another passenger, He will pick a random seat from the available (vacant) seats.

If you are the 100th passenger, what is the probability that you end up in your allotted seat (seat no. 100)?