leetcode_135. Candy ? 待解决

来源:互联网 发布:武汉专业淘宝摄影 编辑:程序博客网 时间:2024/05/23 13:53

There are N children standing in a line. Each child is assigned a rating value.

You are giving candies to these children subjected to the following requirements:

Each child must have at least one candy.
Children with a higher rating get more candies than their neighbors.
What is the minimum candies you must give?

提示:提交代码后,需要用简洁的语言解释一下代码思路~ 谢谢

历史题目和总结见公众号「每日一道算法题」

https://leetcode.com/problems/candy/description/

思路

原创粉丝点击