Certainly, a “Flip” is a must when the current status of a bulb at index i and it’s the target status are not the same.
Initially all bulbs are OFF i.e. 0 and when a bulb at index i is flipped, every bulb after (in the right -> direction) that bulb gets flipped. So it only makes sense to start getting the status of the bulbs correct int the left to right order. … More Leetcode #1529: Bulb Switcher IV