Children stand in a line, each with a rating. Give each child at least one candy, and give a child more candy than a neighbour whenever their rating is higher than that neighbour's. Return the minimum total number of candies.
Practise this challenge
All coding challenges