InterviewBit Academy is now Scaler!
InterviewBit Academy is now Scaler Academy!

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.

Sign Up
to access hints and editorial solutions for Light Switches in the Cellar
Asked In:


Click here to start solving coding interview questions