- Prepare
All Platforms Programming Aptitude Syllabus Interview Preparation Interview Exp. Off Campus - Prime Video
- Prime Mock

- Interview Experience
- Prime VideoNew
- Prime Mock
- Discussion Forum
- Nano Degree
- Prime Video
- Prime Mock

# Bulb in a Circle Puzzle

## Bulb in a Circle Puzzle

On a circle there are 2014 light bulbs, 2 are ON, and 2012 are OFF.

You can choose any bulb and change the neighbor’s state i.e. ON to OFF or OFF to ON.

Doing so, What is the maximum number of bulbs we can turn on?

You can choose any bulb and change the neighbor’s state i.e. ON to OFF or OFF to ON.

Doing so, What is the maximum number of bulbs we can turn on?

## Solution

What we think it depends on the number of light bulbs and the order the two lighted bulbs are in.

**There can be 4 cases****Case 1:**If the two lighted bulbs are next to each other and the total number of lightbulbs is an odd multiple of 2 (odd # * 2), then we can turn on all bulbs.**Case 2:**If the two lighted bulbs are next to each other and the total number of lightbulbs is an even multiple of 2 (even # * 2), then we can turn on all but 2, **unless the total number of bulbs is 2, which doesn’t make sense here as a scenario anyways.**Case 3:**If the two lighted bulbs have a one bulb gap between them, and the total number of lightbulbs is an odd multiple of 2 (odd # *2), then we can turn on all but 2.**Case 4:**If the two lighted bulbs have a one bulb gap between them, and the total number of lightbulbs is an even multiple of 2 (even # * 2), then we can turn on all bulbs.

The two cases relevant here are case #2 and case #4. Try this for the simplest cases: 4 light bulbs and 6 light bulbs, and you’ll quickly see that these conclusions should hold true for larger sets.

## Case 1

**Case 1:**If the two lighted bulbs are next to each other and the total number of light bulbs is an odd multiple of 2 (odd # * 2), then we can turn on all bulbs.

## Case 2

**Case 2:**If the two lighted bulbs are next to each other and the total number of light bulbs is an even multiple of 2 (even # * 2), then we can turn on all but 2, **unless the total number of bulbs is 2, which doesn’t make sense here as a scenario anyways

## Case 3

**Case 3:**If the two lighted bulbs have a one bulb gap between them, and the total number of light bulbs is an odd multiple of 2(odd # *2), then we can turn on all but 2

## Case 4

**Case 4:**If the two lighted bulbs have a one bulb gap between them, and the total number of light bulbs is an even multiple of 2 (even # * 2), then we can turn on all bulbs.

Login/Signup to comment