Tap here to switch tabs
Problem
Submissions

Problem: Minimum Number of Days to Eat N Oranges

med
30 min
Try to solve the Minimum Number of Days to Eat N Oranges problem.

Statement

You are given an integer n, representing the initial number of oranges you have. Each day, you can choose to perform exactly one of the following actions:

  • Eat 11 orange.

  • If n is divisible by 22, eat n /2/ 2 oranges.

  • If n is divisible by 33, eat 2imes(2 imes ( n /3)/ 3) oranges.

Return the minimum number of days required to eat all n oranges.

Constraints:

  • 1≤1 \leq n ≤2imes109\leq 2 imes 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Number of Days to Eat N Oranges

med
30 min
Try to solve the Minimum Number of Days to Eat N Oranges problem.

Statement

You are given an integer n, representing the initial number of oranges you have. Each day, you can choose to perform exactly one of the following actions:

  • Eat 11 orange.

  • If n is divisible by 22, eat n /2/ 2 oranges.

  • If n is divisible by 33, eat 2imes(2 imes ( n /3)/ 3) oranges.

Return the minimum number of days required to eat all n oranges.

Constraints:

  • 1≤1 \leq n ≤2imes109\leq 2 imes 10^9