You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: leetcode/1501-1600/1553.Minimum-Number-of-Days-to-Eat-N-Oranges/README.md
+26-14Lines changed: 26 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -1,28 +1,40 @@
1
1
# [1553.Minimum Number of Days to Eat N Oranges][title]
2
2
3
-
> [!WARNING|style:flat]
4
-
> This question is temporarily unanswered if you have good ideas. Welcome to [Create Pull Request PR](https://github.com/kylesliu/awesome-golang-algorithm)
5
-
6
3
## Description
4
+
There are `n` oranges in the kitchen and you decided to eat some of these oranges every day as follows:
5
+
6
+
- Eat one orange.
7
+
- If the number of remaining oranges `n` is divisible by `2` then you can eat `n / 2` oranges.
8
+
- If the number of remaining oranges `n` is divisible by `3` then you can eat `2 * (n / 3)` oranges.
9
+
10
+
You can only choose one of the actions per day.
11
+
12
+
Given the integer `n`, return the minimum number of days to eat `n` oranges.
7
13
8
14
**Example 1:**
9
15
10
16
```
11
-
Input: a = "11", b = "1"
12
-
Output: "100"
17
+
Input: n = 10
18
+
Output: 4
19
+
Explanation: You have 10 oranges.
20
+
Day 1: Eat 1 orange, 10 - 1 = 9.
21
+
Day 2: Eat 6 oranges, 9 - 2*(9/3) = 9 - 6 = 3. (Since 9 is divisible by 3)
22
+
Day 3: Eat 2 oranges, 3 - 2*(3/3) = 3 - 2 = 1.
23
+
Day 4: Eat the last orange 1 - 1 = 0.
24
+
You need at least 4 days to eat the 10 oranges.
13
25
```
14
26
15
-
## 题意
16
-
> ...
27
+
**Example 2:**
17
28
18
-
## 题解
19
-
20
-
### 思路1
21
-
> ...
22
-
Minimum Number of Days to Eat N Oranges
23
-
```go
24
29
```
25
-
30
+
Input: n = 6
31
+
Output: 3
32
+
Explanation: You have 6 oranges.
33
+
Day 1: Eat 3 oranges, 6 - 6/2 = 6 - 3 = 3. (Since 6 is divisible by 2).
34
+
Day 2: Eat 2 oranges, 3 - 2*(3/3) = 3 - 2 = 1. (Since 3 is divisible by 3)
0 commit comments