Home » Other » General » Puzzle n°- Traverse through 100 doors, find which are open/closed **
Puzzle n°- Traverse through 100 doors, find which are open/closed ** [message #614731] Mon, 26 May 2014 11:07 Go to next message
Lalit Kumar B
Messages: 1885
Registered: May 2013
Location: World Wide on the Web
Senior Member
Problem: You have 100 doors in a row that are all initially closed. You make 100 passes by the doors. The first time through, you visit every door and toggle the door (if the door is closed, you open it; if it is open, you close it). The second time you only visit every 2nd door (door #2, #4, #6, ...). The third time, every 3rd door (door #3, #6, #9, ...), etc, until you only visit the 100th door.

Question: Write a SQL to determine what state are the doors in after the last pass? Which are open, which are closed?

The doors can be considered as rown in table. A flag could be used as a column to store the status open/close.

P.S. : It has had been one of the favorite questions in management exams in the logical reasoning section.

Regards,
Lalit
Re: Puzzle n°- Traverse through 100 doors, find which are open/closed ** [message #614735 is a reply to message #614731] Mon, 26 May 2014 12:25 Go to previous messageGo to next message
Michel Cadot
Messages: 58643
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Same than Puzzle n°13 - light bulbs

Re: Puzzle n°- Traverse through 100 doors, find which are open/closed ** [message #614737 is a reply to message #614735] Mon, 26 May 2014 12:34 Go to previous message
Lalit Kumar B
Messages: 1885
Registered: May 2013
Location: World Wide on the Web
Senior Member
Duh, how did I miss it in the puzzle menu sticky. Sorry Sad

Let me find some other puzzles. Thanks Michel Smile

[Updated on: Mon, 26 May 2014 13:51]

Report message to a moderator

Previous Topic: Puzzle n°01 - Finding adjacent seats in theater **
Next Topic: Data modelling involving many-to-many relationship and parent child hierarchy
Goto Forum:
  


Current Time: Fri Aug 01 20:28:29 CDT 2014

Total time taken to generate the page: 0.08543 seconds