Untitled
unknown
python
4 years ago
479 B
6
Indexable
candies = [1]* len(input)
Done = True
while not Done:
for i in range(0, len(input-1)):
if input(i)>input(i+1) and candies[i]<=candies[i+1]:
candies(i)+=1
Done = False
for i in range(1, len(input)):
if input(i)>input(i-1) and candies[i]<=candies[i-1]:
candies(i)+=1
Done = False
return sum(candies)Editor is loading...