Tuesday's common C++ interview problem: Candy for greedy children.
Given a line of children with different levels of greediness, determine the minimum number of candies you need to use to satisfy every child.
Each child must receive at least one candy, and each child must receive more candy than their less greedy neighbours.
Solve it yourself: https://compiler-explorer.com/z/cc5369doa
Solution: https://compiler-explorer.com/z/bcYG9541x