Skip to content

Instantly share code, notes, and snippets.

@thaisviana
Created October 31, 2019 16:49
Show Gist options
  • Save thaisviana/72a45592c02076af7ce5b6bf688b7758 to your computer and use it in GitHub Desktop.
Save thaisviana/72a45592c02076af7ce5b6bf688b7758 to your computer and use it in GitHub Desktop.
def solution(A):
all_bulbs_shine = 0
accumulative_index = 0
accumulative_bulb = 0
for index, bulb in enumerate(A):
accumulative_index += index +1
accumulative_bulb += bulb
if accumulative_index == accumulative_bulb:
all_bulbs_shine += 1
print(index,bulb)
return all_bulbs_shine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment