Skip to content

Commit 15fa32f

Browse files
committed
553
1 parent 7525bd9 commit 15fa32f

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Math/553.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## 553 Optimal Division
2+
3+
#### Description
4+
5+
[link](https://leetcode.com/problems/optimal-division/)
6+
7+
---
8+
9+
#### Solution
10+
11+
- See Code
12+
13+
---
14+
15+
#### Code
16+
17+
<!-- O(n) -->
18+
19+
```python
20+
class Solution:
21+
def optimalDivision(self, nums: List[int]) -> str:
22+
A = list(map(str, nums))
23+
if len(A) <= 2:
24+
return '/'.join(A)
25+
return A[0] + '/(' + '/'.join(A[1:]) + ')'
26+
```

0 commit comments

Comments
 (0)