var candy = function(ratings) { let len = ratings.length let candy = Array(len).fill(1) // 正向循环一遍 for(let i = 1; i < len; i++) { if(ratings[i] > ratings[i - 1]) { candy[i] = candy[i - 1] + 1 } } // 正向边界处理,如果candy[0]变了,再循环更新一遍,直至不需更新为止 while((ratings[0] > ratings[...