Sunday, 14 October 2012

100 locker riddle

0 comments

Puzzle:

There are 100 closed lockers in a hallway. A man begins by opening all the 100
lockers. Next, he closes every second locker. Then he goes to every third locker
and closes it if it is open or opens it if it is closed (eg, he toggles every third
locker). After his 100th pass in the hallway, in which he toggles only locker
number 100, how many lockers are open?

Thursday, 11 October 2012

Solution: People`s hat puzzle on Island..(awesome logic)

0 comments

Solution:

This problem seems hard, so let’s simplify it by looking at specific cases.
Case c = 1: Exactly one man is wearing a hat.
Assuming all the men are intelligent, the man with the hat should look around and realize
that no one else is wearing a hat. Since the genie said that at least one person is wearing a
hat, he must conclude that he is wearing a hat. Therefore, he would be able to remove it that
night.

Case c = 2: Exactly two men are wearing hat.
The two men with hat see one crown, and are unsure where c = 1 or c = 2. They know, from
the previous case, that if c = 1, the crowns would be removed on Night #1. Therefore, if the
other man still has a hat, he must deduce that c = 2, which means that he has a hat. Both men
would then remove the crown on Night #2

People`s hat puzzle on Island..(awesome logic)

0 comments

Puzzle:

A bunch of men are on an island. A genie comes down and gathers everyone
together and places a magical hat on some people’s heads (e.g., at least one).
The hat is magical: it can be seen by other people, but not by the wearer of the
hat himself. To remove the hat, you must dunk yourself underwater at exactly
midnight. If there are n people and c hats, how long does it take the men remove
the crowns? The men cannot tell each other (in any way) that they have
a hat.

Tuesday, 9 October 2012

2 eggs dropped from 100th floor with Best solution

0 comments

Problem Statement:

There is a building of 100 floors. If an egg drops from the Nth floor or above it
will break. If it’s dropped from any floor below, it will not break. You’re given 2 eggs. Find N, while minimizing the number of drops for the worse case.
Solution:
Observation: Regardless of how we drop Egg1, Egg2 must do a linear search. Eg, if the Egg1
breaks between floor 10 and 15, we have to check every floor in between with the Egg2
The Approach:
A First Try: Suppose we drop an egg from the 10th floor, then the 20th, …
»» In the first egg breaks on the first drop (Floor 10), then we have at most 10 drops total.
»» If the first egg breaks on the last drop (Floor 100), then we have at most 19 drops total
(floors 1 through 100, then 91 through 99).

Saturday, 15 September 2012

Recent comments

Send Quick Massage

Name

Email *

Message *

Recent posts

Total Pageviews

Blog Archive