Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
TopCoder SRM 645 Div2
# SRM #645 Div2 Easy
class BacteriesColony():
def performTheExperiment(self, c):
while True:
diff = [0] * len(c)
for i in range(1, len(c)-1):
if c[i] > c[i-1] and c[i] > c[i+1]:
diff[i] = -1
elif c[i] < c[i-1] and c[i] < c[i+1]:
diff[i] = 1
if all([i == 0 for i in diff]):
c = [i + j for i, j in zip(c, diff)]
return c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.