Puzzle | The Circle of Lights Last Updated : 18 Jan, 2023 Comments Improve Suggest changes Like Article Like Report There is a circle of N > 2 lights with a switch next to each of them. Each switch can be flipped between two positions, thereby toggling the on/off states of three lights: its own and the two lights adjacent to it. Initially, all the lights are off. Design an algorithm for turning all the lights on by flipping the minimum number of switches. Solution: Since all the lights are off initially, it is obvious that the final state of the lights depends only on the parity(odd or even) of the number of times each switch is flipped and does not depend on the order in which the switches are manipulated. To turn on a light, we can either flip its switch and leave the adjacent switches off, or we flip all the three switches, for a group of three lights. Assuming the lights are numbered from 1 to N in the clockwise order, we have two cases. N is divisible in 3: In this case, we flip the switch for 1st bulb, which lights the bulbs 1, 2 and N. Then we flip the switch of 4th bulb, which lights the bulb 3, 4, and 5. In this manner, we flip the switch of every 3K + 1 bulb until we flip the switch of N - 2 bulb, which will light up the last 3 bulbs. This results in a total of N/3 switch flips. N is not divisible by 3: In this case, suppose we follow the same procedure as above. This will only turn on the bulbs in multiple of 3. So at last, there will be one or two bulbs, which will be off. Flipping the switch of one of these bulbs, we turn off at least one bulb. This bulb, say X, which now has gone off due to the previous flip has been toggled even number of times, to turn it on, the switch of either X or one of its adjacent bulbs which hasn't been flipped needs to be flipped. In this way, we have to flip the switch of each of the bulb whose switch hasn't been flipped. This results in a total of N switch flips. Comment More infoAdvertise with us Next Article Puzzle | The Circle of Lights C CharchitKapoor Follow Improve Article Tags : Aptitude Logical Puzzles Similar Reads Puzzle | Light all the bulbs Problem Statement: 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 switch all the 2014 light bulbs on?Solution: Yes, it is possible to get all the light bulbs ON.F 2 min read Puzzle 42 | (Placing the numbers) Place the numbers 1, 2, 3, 4, 5, 6, 7, 8 into the eight circles in figure given below, in such a way that no number is adjacent to a number that is next to it in the sequence.For example 1 should not be adjacent to 2 but can be adjacent to 3, 4, 5, 6, 7, 8. Similarly for others. We strongly recommen 2 min read Puzzle - Two Creepers Climbing a Tree Question: Jasmine and rose creepers are two creepers (climbing plants) that are both climbing up and around a cylindrical tree trunk. Both jasmine and rose begin at the same spot on the ground and twist both clockwise and counterclockwise. The rose had done three complete twists and the jasmine had 3 min read Important Points About Circle The collection of all the points in a plane, which are at a fixed distance from a fixed point in the plane, is called a circle. Here, the fixed point is called the center âOâ. Some of the important terminologies used in the circle are as follows:circleThese are following important points about circl 4 min read Puzzle | Maximum pieces that can be cut from a Circle using 6 straight lines PUZZLE:Given a Circle and Six Straight Lines. What is the maximum number of pieces that one can cut the circle using these six straight lines?SOLUTION:Using six lines, we can cut the circle into 22 pieces at maximum.Using one line, the circle can be divided into two parts.Two lines divide the circle 1 min read Like