InterviewBit Academy is now Scaler!
Learn Tech Skills from Scratch @ Scaler EDGE

Light Switches in the Cellar


In your cellar there are three light switches in the OFF position. Each switch controls one of three light bulbs on floor above.
You may move any of the switches but you may only go upstairs to inspect the bulbs.
When upstairs, you cannot access the switches. What is the minimum number of times you need to go upstairs to determine the switch for each bulb?

Since your answer is a integer, just put the number without any decimal places if its an integer. If the answer is Infinity, output Infinity.

Hints
  • Complete Solution
Asked In:

Discussion


Loading...
Click here to start solving coding interview questions