Practice Bulb Switcher II
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Bulb Switcher II
Problem Statement
The n bulbs numbered 1 through n begin switched on. Four buttons toggle, respectively: every bulb; only even-numbered bulbs; only odd-numbered bulbs; or bulbs numbered 1, 4, 7, 10 and so on. Make exactly presses button presses, choosing any button each time and allowing repeats. Return the number of distinct final on/off arrangements that can result.
Source: Bulb Switcher II on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
n = 1, presses = 1
2
# Example 2
n = 2, presses = 1
3
# Example 3
n = 3, presses = 1
4
Constraints
Related LeetCode Problems
Practice more problems similar to Bulb Switcher II.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.