Question Regarding Question Neighbor Requirements


  • 0
    D

    So a quick question regarding the increased candy if the neighboring kids and lower ratings.

    Assuming we have a set of children like this:

    Current Index
        ||
        \/
    [ 0, 2, 1]
    

    In this case would the child be receiving 1 or 2 pieces of candy? Technically the child has a higher rating than their neighbors, however since it's larger than either neighbor and one of the neighbors is larger than the other, I'm assuming 2, however I can see 1 being the correct answer as well.

    I want to avoid spoiling the solution for myself, so I figured I would ask here exactly what they meant as far as how ratings and their neighbors affect the total amount of candy that's supposed to be given out. Thanks!


Log in to reply
 

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