Light all the bulbs — Puzzle for Interview rounds
Consider a circle with 2014 light bulbs and only 2 of them are on and the rest are off. Anyone can choose any of the bulbs and change the state of the neighboring bulbs. The task is to find if we can switch all the 2014 light bulbs on ?
Yes, it is possible to get all the light bulbs ON.
- Firstly label all the 2014 light bulbs from B-1 to B-2014(in sequence).
- As the positions of the light bulbs in the ON state are not mentioned in the problem statement.
- So, consider that those 2 bulbs are adjacent to each other and are labeled B-1 and B-2.
- Therefore, bulbs labeled from B-3 to B-2014 are initially in the OFF state and all the bulbs in the OFF state are adjacent to each other.
Follow the steps below to solve the given problem:
- Consider all the 2012 remaining bulbs in groups of 4.
2. In order to light up all the bulbs perform the following strategy:
- The first group consists of bulbs B-3 to B-6.
- Select the second bulb from the chosen group and change the state of adjacent bulbs.
- Here, select bulb B-4 and change the state of bulbs B-3 and B-5 from the OFF state to the ON state.
- The second step is to select a third bulb from the chosen group and change the state of its adjacent bulbs.
- Here, select the bulb B-5 and change the state of bulbs B-4 and B-6 from OFF to ON.
3. Similarly, the above process can be repeated for a total of 503 groups(consisting of 4 light bulbs each) and all the given 2014 light bulbs can lighten up.