Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Last Updated: Mar 27, 2024

Light Switches in the Cellar

Leveraging ChatGPT - GenAI as a Microsoft Data Expert
Speaker
Prerita Agarwal
Data Specialist @
23 Jul, 2024 @ 01:30 PM
Interview Puzzles

Introduction

Puzzles develop memory skills and an ability to plan, test ideas, and solve problems. While completing a puzzle, we need to remember the shapes, colors, positions, and strategies to achieve them.

illustration image

Light switches in the cellar is a very famous riddle that requires the person to think outside the box critically. The answer to this type of result may be evident to many, but most could not come up with it on their first try. Let's give it a go and see how to solve this problem.

Problem Statement

In your cellar, there are three light switches in the OFF position. Every switch controls 1 of 3 light bulbs on the above floor.

You can move any of the switches, but you can only go upstairs to examine the bulbs one time. How can you locate the switch for each bulb with one inspection?

Hint

In this puzzle, you might already know the answer. In case you don't, here is a hint for you. Take it as a real-world problem. Think of the properties of current.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Solution

The number of switches is 1, 2, and 3.

Switch on number 1 for some minutes, then switch it off. Switch on number 2. Go upstairs.

The light bulb that is on is connected to switch 2. The light bulb that is off and warm is connected to switch 1. The light bulb that is off & cold is connected to switch 3!

Check out this problem - 8 Queens Problem

Frequently Asked Questions

What are the light switches in the cellar?

There are three light switches in your cellar, each in the OFF position. Each switch controls 1 of 3 light bulbs on the floor above. You may move any of the buttons, but you may only go upstairs to inspect the bulbs one time.

Why do we do puzzles in interviews?

Usually, interviewers ask puzzles to see how you go about solving a tricky problem. Most companies avoid asking it because most puzzles hinge on a single trick that a person can easily miss when he is having a bad or nervous day.

What is a puzzle interview?

Microsoft popularized the puzzle interview in the 1990s. Puzzle interviews ask the applicant to solve puzzles like "Why are manhole covers round?" or unusual problems like, "How would you weigh an airplane without a scale?".

What are some of the most typical puzzles posed during an interview?

Some of the most popular interview puzzles are:
Crossing the Bridge Puzzle
The Man in the Elevator Puzzle
Heaven or Hell Puzzle
Three Mislabeled Jars
Gold Bar Cut Puzzle
Man Fell in Well Puzzle
Horses on a Race Track Puzzle
Bag of Coins Puzzle

Will puzzles be asked in interviews all the time?

While most interviewers do not usually ask for puzzles, they are relatively frequent, and some interviews may even include specialized puzzle-solving parts. It's always a good idea to be prepared in case something happens.

Conclusion

This article gives information about the light switches in the cellar and how puzzles like light switches in the cellar make an individual's problem-solving skills better.

Recommended Readings:


Do check out The Interview guide for Product Based Companies as well as some of the Popular Interview Problems from Top companies like Amazon, Adobe, Google, etc. on Coding Ninjas Studio.

Also check out some of the Guided Paths on topics such as Data Structure and Algorithms, Competitive Programming, Operating Systems, Computer Networks, DBMS, System Design, etc. as well as some Contests, Test Series, Interview Bundles, and some Interview Experiences curated by top Industry Experts only on Coding Ninjas Studio.

Do upvote our blog to help other ninjas grow.

Happy Learning!

Topics covered
1.
Introduction
2.
Problem Statement
3.
Solution
4.
Frequently Asked Questions
4.1.
What are the light switches in the cellar?
4.2.
Why do we do puzzles in interviews?
4.3.
What is a puzzle interview?
4.4.
What are some of the most typical puzzles posed during an interview?
4.5.
Will puzzles be asked in interviews all the time?
5.
Conclusion