Practice Problem

Candy

Difficulty: Hard

Given an array of children's ratings, distribute the minimum number of candies such that each child gets at least one and children with higher ratings get more candies than their neighbors.