Created
October 31, 2019 16:49
-
-
Save thaisviana/72a45592c02076af7ce5b6bf688b7758 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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