Search⌘ K
AI Features

Solution: Bulb Switcher

Solution: Bulb Switcher gives you bulbs that start off and an equal number of rounds. Round one toggles all bulbs; later rounds toggle every bulb at multiples of their round number. Return how many remain on.

Statement

You are given n bulbs, all initially turned off. You perform n rounds of toggling operations:

  • In round 11 ...