Search⌘ K
AI Features

Bulb Switcher

Bulb Switcher starts with n bulbs off and runs n rounds. The first toggles all bulbs, while later rounds toggle every second, third, or later bulb as appropriate. Return how many remain on.

Statement

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