Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
479 B
1
Indexable
Never
        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)