Java Solution, Fraction Addition and GCD
\npublic class Solution {\n    public String fractionAddition(String expression) {\n        List<String> nums = new ArrayList<>();\n        int i = 0, j = 0;\n 
```\npublic class Solution {\n    public String fractionAddition(String expression) {\n        List<String> nums = new ArrayList<>();\n        int i = 0, j = 0;\n        while (j <= expression.length()) {\n            if (j == expression.length() || j != i && (expression.charAt(j) == '+' || expression.charAt(j) == '-')) {\n                if (expression.charAt(i) == '+') {\n                    nums.add(expression.substring(i + 1, j));\n                }\n                else {\n                    nums.add(expression.substring(i, j));\n                }\n                    \n                i = j;\n            }\n            j++;\n        }\n        \n        String result = "0/1";\n        \n        for (String num : nums) {\n            result = add(result, num);\n        }\n        \n        return result;\n    }\n    \n    private String add(String s1, String s2) {\n        String[] sa1 = s1.split("/");\n        String[] sa2 = s2.split("/");\n        int n1 = Integer.parseInt(sa1[0]);\n        int d1 = Integer.parseInt(sa1[1]);\n        int n2 = Integer.parseInt(sa2[0]);\n        int d2 = Integer.parseInt(sa2[1]);\n        \n        int n = n1 * d2 + n2 * d1;\n        int d = d1 * d2;\n        \n        if (n == 0) return "0/1";\n        \n        boolean isNegative = n * d < 0;\n        n = Math.abs(n);\n        d = Math.abs(d);\n        int gcd = getGCD(n, d);\n        \n        return (isNegative ? "-" : "") + (n / gcd) + "/" + (d / gcd);\n    }\n    \n    private int getGCD(int a, int b) {\n        if (a == 0 || b == 0) return a + b; // base case\n        return getGCD(b, a % b);\n    }\n}\n```
[]