1744. Can You Eat Your Favorite Candy on Your Favorite Day

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 1744

class Solution:
    def canEat(self, candiesCount: List[int], queries: List[List[int]]) -> List[bool]:
        s = list(accumulate(candiesCount, initial=0))
        res = []
        for t, day, mx in queries:
            least, most = day, (day + 1) * mx
            res.append(least < s[t + 1] and most > s[t])
        return res