Untitled
unknown
python
3 years ago
325 B
8
Indexable
def distribute_candy(children_ratings): total_candy = 0 previous_child_rating = 0 previous_child_candy = 0 for i in range(len(children_ratings)): if previous_child_rating < i: previous_child_candy += 1 total_candy += previous_child_candy previous_child_candy =
Editor is loading...