Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 1744. Can You Eat Your Favorite Candy on Your Favorite Day?
Given candy counts per type and queries (favoriteType, favoriteDay, dailyCap), determine whether you can eat at least one and at most dailyCap candies per day, consuming types in order, so that you eat a candy of the favorite type on the specified day. Reduce each query to a prefix-sum range-overlap check: compute the minimum and maximum total candies you could have eaten by that day and see if that interval intersects the interval of candy indices for the favorite type.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.