Bulb Switcher IV(LeetCode 1529):

Problem