Search⌘ K
AI Features

Solution: Bulb Switcher

Solution: Bulb Switcher gives you n bulbs that start off and undergo n rounds: first all are toggled, then every second bulb, every third bulb, and so on. Return how many stay on.

Statement

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

  • In round 11 ...