"higher rating get more candies than their neighbors", what does "neighbors" bean?


  • 1
    L

    Does it mean the kid is only required to have more candy than those next to him?

    Say

    rating:
    [ 1, 15, 13 ]

    Is
    [1, 2, 1] a valid answer?


  • 0
    S

    Yes, children stand in line, neighbors is children next to him. However, the most left and most right child will have only one neighbor.


Log in to reply
 

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