I didn't get the Candy Question ??


  • 1
    M

    The candy question on OJ is not clear..
    Can someone helps me to understand the question..

    I mean what so you mean if child has higher rating (than whom??) it should have more candies than its neigbours (which neigbours ??)

    can someone can give the sample test cases.. PLZ..


  • 3
    E

    A child who has a rating should have more candies than its neighbors means that the number of candies that he/she has is more than neighbors whose rating is lower than him/her.
    Simple example: children1, 2, and 3 with rating 1,3,4.
    Then minimum candies given to them should be:1,2,3
    if rating is 1,4,3, then candies given to them should be:1,2,1


Log in to reply
 

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