Minimum Number of Days to Eat N Oranges

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
class Solution:
    @lru_cache()
    def minDays(self, n: int) -> int:
        if n <= 1:
            return n;
        remainder_div_by_2 = n % 2
        remainder_div_by_3 = n % 3

        days_with_div_by_2 = remainder_div_by_2 + self.minDays(n // 2)
        days_with_div_by_3 = remainder_div_by_3 + self.minDays(n // 3)

        minimum_days = min(days_with_div_by_2, days_with_div_by_3)

        result = 1 + minimum_days

        return result