Why is this a Greedy algortihm problem?


why is this a Greedy algorithm problem? it’s more of a brain teaser.
the fact that i am switching on the first off bulb is greedy nature? Is there a non-greedy way of solving it?

My sol:
class Solution:
# @param A : list of integers
# @return an integer
def bulbs(self, A):
count = 0
flag = True
# if any bulb switched twice, it will come back to original state
for bulb in A:
if bulb == 0 and flag: #this bulb in original state
count += 1
flag = False
elif bulb ==1 and not flag: #this bulb not in orig state, i.e now in off mode
count += 1
flag = True

    return count


This is a greedy problem because you cannot make a decision later about an OFF bulb if you move ahead without turning it ON.
The problem demands every bulb to be ON, so when you encounter an OFF bulb, you MUST turn it ON, simple.
Hope that clarifies.