Skip to content

Commit c29e1d6

Browse files
refactor 553
1 parent 31af401 commit c29e1d6

File tree

1 file changed

+0
-28
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-28
lines changed

src/main/java/com/fishercoder/solutions/_553.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,6 @@
22

33
import java.util.StringJoiner;
44

5-
/**
6-
* 553. Optimal Division
7-
*
8-
* Given a list of positive integers, the adjacent integers will perform the float division. For example, [2,3,4] -> 2 / 3 / 4.
9-
However, you can add any number of parenthesis at any position to change the priority of operations.
10-
You should find out how to add parenthesis to get the maximum result,
11-
and return the corresponding expression in string format.
12-
Your expression should NOT contain redundant parenthesis.
13-
14-
Example:
15-
Input: [1000,100,10,2]
16-
Output: "1000/(100/10/2)"
17-
Explanation:
18-
1000/(100/10/2) = 1000/((100/10)/2) = 200
19-
However, the bold parenthesis in "1000/((100/10)/2)" are redundant,
20-
since they don't influence the operation priority. So you should return "1000/(100/10/2)".
21-
22-
Other cases:
23-
1000/(100/10)/2 = 50
24-
1000/(100/(10/2)) = 50
25-
1000/100/10/2 = 0.5
26-
1000/100/(10/2) = 2
27-
Note:
28-
29-
The length of the input array is [1, 10].
30-
Elements in the given array will be in range [2, 1000].
31-
There is only one optimal division for each test case.
32-
*/
335
public class _553 {
346
public static class Solution1 {
357
/**

0 commit comments

Comments
 (0)