Skip to content

Commit 5b61b57

Browse files
refactor 592
1 parent f248b84 commit 5b61b57

File tree

1 file changed

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

1 file changed

+0
-36
lines changed

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

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,6 @@
33
import java.util.ArrayList;
44
import java.util.List;
55

6-
/**
7-
* 592. Fraction Addition and Subtraction
8-
*
9-
* Given a string representing an expression of fraction addition and subtraction,
10-
* you need to return the calculation result in string format.
11-
* The final result should be irreducible fraction.
12-
* If your final result is an integer,
13-
* say 2, you need to change it to the format of fraction that has denominator 1.
14-
* So in this case, 2 should be converted to 2/1.
15-
16-
Example 1:
17-
Input:"-1/2+1/2"
18-
Output: "0/1"
19-
20-
Example 2:
21-
Input:"-1/2+1/2+1/3"
22-
Output: "1/3"
23-
24-
Example 3:
25-
Input:"1/3-1/2"
26-
Output: "-1/6"
27-
28-
Example 4:
29-
Input:"5/3+1/3"
30-
Output: "2/1"
31-
32-
Note:
33-
The input string only contains '0' to '9', '/', '+' and '-'. So does the output.
34-
Each fraction (input and output) has format ±numerator/denominator.
35-
If the first input fraction or the output is positive, then '+' will be omitted.
36-
The input only contains valid irreducible fractions,
37-
where the numerator and denominator of each fraction will always be in the range [1,10].
38-
If the denominator is 1, it means this fraction is actually an integer in a fraction format defined above.
39-
The number of given fractions will be in the range [1,10].
40-
The numerator and denominator of the final result are guaranteed to be valid and in the range of 32-bit int.
41-
*/
426
public class _592 {
437

448
public static class Solution1 {

0 commit comments

Comments
 (0)