Problem - Candy

There are nn children in a line, each with a rating. Give each child at least 11 candy. Children with higher ratings than neighbors must get more candy. Minimize total candies.

This is LeetCode 135135. One pass isn't enough because you don't know how many candies the right neighbor will need. Two passes solve this.