Monday, 12 November 2012

Wednesday, 24 October 2012

3 switches puzzle

0 comments

Puzzle:

You have just walked into a dark two-storey house. There are three light switches on the first floor A, B and C. Only one of the switches works, and it turns on the light on the second floor.
You cannot see the second floor light from the first floor and there are no windows in the building, but you do have a flashlight.
You can only make one trip up the stairs, and you can only flip one switch at a time. How do you determine which of the three switches turns on the light on the second floor ?

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?

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).

Recent comments

Send Quick Massage

Name

Email *

Message *

Recent posts

Total Pageviews

Blog Archive