Bulb Switcher

Revision en1, by Mohsina_Shaikh, 2022-08-19 05:40:07

Hello can anyone please help on how to solve this problem. There is a room with n bulbs labeled from 1 to n that all are turned on initially, and four buttons on the wall. Each of the four buttons has a different functionality where:

Button 1: Flips the status of all the bulbs. Button 2: Flips the status of all the bulbs with even labels (i.e., 2, 4, ...). Button 3: Flips the status of all the bulbs with odd labels (i.e., 1, 3, ...). Button 4: Flips the status of all the bulbs with a label j = 3k + 1 where k = 0, 1, 2, ... (i.e., 1, 4, 7, 10, ...). You must make exactly presses button presses in total. For each press, you may pick any of the four buttons to press.

Given the two integers n and presses, return the number of different possible statuses after performing all presses button presses. Adding the link for reference Bulb Switcher

Im not able to reach to a solution for this problem.Any help would be appreciated.

Tags math, bit manipulation

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Mohsina_Shaikh 2022-08-23 05:18:58 761
en1 English Mohsina_Shaikh 2022-08-19 05:40:07 1010 Initial revision (published)