What will be the right answer for the following rating list?


  • 2
    W

    The requirements are :

    1. Each child must have at least one candy.
    2. Children with a higher rating get more candies than their neighbors.

    Will children with the same rating get the same number of candies?

    Is [1, 2, 1, 2, 1] an acceptable assignment for the rating list [3, 4, 4, 4, 3]?


  • 3
    S

    Yes, it is an acceptable assignment. There is no rules for neighbors which has the same ratings.


  • 0
    W
    This post is deleted!

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.