Search
⌘K

Leetcode 672. Bulb Switcher II

Given n bulbs initially on and four toggle operations (flip all / evens / odds / positions 3k+1), determine how many distinct final configurations are reachable after exactly presses button presses. Key idea: the operations commute and the bulb pattern repeats every 6 positions, so the problem reduces to enumerating reachable bitmasks on a small prefix.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.