Skip to content

Commit 162f764

Browse files
authored
Update readme.md
1 parent 5ff28ef commit 162f764

File tree

1 file changed

+9
-5
lines changed
  • src/main/java/g2001_2100/s2059_minimum_operations_to_convert_number

1 file changed

+9
-5
lines changed

src/main/java/g2001_2100/s2059_minimum_operations_to_convert_number/readme.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,22 @@ Return _the **minimum** number of operations needed to convert_ `x = start` _int
2020

2121
**Output:** 2
2222

23-
**Explanation:** We can go from 2 → 14 → 12 with the following 2 operations.
24-
- 2 + 12 = 14
25-
- 14 - 2 = 12
23+
**Explanation:** We can go from 2 → 14 → 12 with the following 2 operations.
24+
25+
- 2 + 12 = 14
26+
27+
- 14 - 2 = 12
2628

2729
**Example 2:**
2830

2931
**Input:** nums = [3,5,7], start = 0, goal = -4
3032

3133
**Output:** 2
3234

33-
**Explanation:** We can go from 0 → 3 → -4 with the following 2 operations.
34-
- 0 + 3 = 3
35+
**Explanation:** We can go from 0 → 3 → -4 with the following 2 operations.
36+
37+
- 0 + 3 = 3
38+
3539
- 3 - 7 = -4
3640

3741
Note that the last operation sets x out of the range 0 <= x <= 1000, which is valid.

0 commit comments

Comments
 (0)