DSA Key Problems

Candy

Given children's ratings in a line, distribute positive numbers of candies so each child with a higher rating than an adjacent child receives more candy. Return the minimum total number of candies required.