Please help me identify these 100 light bulbs by turning ON and OFF their switches.

Photo by Juan Carlos Becerra on Unsplash.

Problem statement

I have a very peculiar room in my house. It's a simple room that doesn't have much decoration. However, I do have 100 light bulbs hanging from the ceiling because I thought it would look cool. When I installed the 100 light bulbs I wanted maximum freedom, so I also installed 100 independent switches:

  • each switch controls exactly one light bulb; and
  • each light bulb is controlled by exactly one switch.

Of course I was completely silly, so I installed the switches in a room that is far from the room with the light bulbs and I completely forgot which light switch controls which light bulb. How can I identify which switch controls which light bulb in the least amount of trips possible?

For example, I could flip ON a switch and then go verify which light bulb turned ON, and I could do this for the 100 light bulbs... But that would take me 100 trips.

Give it some thought!

If you need any clarification whatsoever, feel free to ask in the comment section below.

This problem was adapted from here and is licensed under CC BY-SA 3.0.

Solvers

Congratulations to the ones that solved this problem correctly and, in particular, to the ones who sent me their correct solutions:

  • David H., Taiwan;
  • Shubham S., India;
  • Dan, USA;
  • Jeena K., India;
  • Frank X., Shenzhen, China;
  • Wolfgang, Germany;
  • Naveen K., India;
  • Pedro G., Portugal;
  • Dylan S., USA;
  • Vladimir L., USA;
  • Sean L., USA;

Know how to solve this? Join the list of solvers by emailing me your solution!

Solution

I'll post the solution here once this problem has been live for 2 weeks, which will be around the 10th of April.

Don't forget to subscribe to the newsletter to get bi-weekly problems sent straight to your inbox.

Take your Python 🐍 skills to the next level πŸš€

If you enjoyed this blog article, you will love the mathspp insider πŸπŸš€ newsletter! Join +16.000 others who are taking their Python 🐍 skills to the next level! πŸš€

Previous Post Next Post

Blog Comments powered by Disqus.