Search
⌘K

Leetcode 1553. Minimum Number of Days to Eat N Oranges

Given n, compute the minimum days to reduce it to 0 when each day you may either eat 1 orange, or—if n is divisible—eat n/2 (leaving n/2) or eat 2*(n/3) (leaving n/3). With n up to 2×10^9 the challenge is to avoid linear DP and use recursion with memoization / divide-and-conquer to explore optimal divide-by-2/3 reductions.

Asked at:

Google

Google


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Mid September, 2024

Google

Google

Mid-level

Minimum Steps To Reduce N To 1: Given a number N, count minimum steps to minimize it to 1 according to the following criteria: If N is divisible by 2 then reduce N to N/2. If N is divisible by 3 then reduce N to N/3. Otherwise, decrement N by 1.

Comments

Your account is free and you can post anonymously if you choose.