100% beats || 0ms runtime Easy solution with Explaination ...
Intuition\nso,the thought is just to take numerator and denominator of two fraction and calculate their answer...\n\n# Approach\n- so,we first took numerator an
# Intuition\nso,the thought is just to take numerator and denominator of two fraction and calculate their answer...\n\n# Approach\n- so,we first took numerator an denominator using for loop and conditions,and update our operation **op** which **needs to be operated**..\n\n- then we are using while loop an dgoing thorugh every single fraction and calculating their answer and updating our **nu & de** variable\n\n- we are doing this by taking **lcm** of denominators and then finally **hcf** for **minimizing** our **nu & de** varibales\n\n# Complexity\n- Time complexity:\n# - n=size of expression string\n**kind of constant for gcd calculation,max(32 operation)**\n- then stoi fxn -- **O(n)**\n- nearly around -- O(2*n);\n\n- Space complexity: **O(n)**\n- **max size of string s-> n**\n\n# Code\n```cpp []\nclass Solution {\n    typedef long long ll;\n\npublic:\n    string fractionAddition(string exp) {\n        if (exp == "")\n            return "0/1";\n        ll nu, de;\n        string s = "";\n        char op = \'+\';\n        int i = 0;\n        for (; i < exp.size(); i++) {\n            if (i != 0 && (exp[i] == \'+\' || exp[i] == \'-\')) {\n                op = exp[i];\n                de = stoi(s);\n                s = "";\n                i++;\n                break;\n            } else if (i == exp.size() - 1) {\n\n                de = stoi(s + exp[i]);\n                s = "";\n            } else if (exp[i] == \'/\') {\n\n                nu = stoi(s);\n\n                s = "";\n            } else {\n                s += exp[i];\n            }\n        }\n        ll tn, td;\n        while (i < exp.size()) {\n            if (exp[i] == \'+\' || exp[i] == \'-\') {\n                td = stoi(s);\n                s = "";\n\n                ll lcm = (de * td) / (__gcd(de, td));\n                ll upnu = nu * (lcm / de);\n                ll tnu = tn * (lcm / td);\n\n                if (op == \'+\') {\n                    nu = upnu + tnu;\n                } else {\n                    nu = upnu - tnu;\n                }\n                de = lcm;\n\n                ll hcf = abs(__gcd(nu, de));\n                nu /= hcf;\n                de /= hcf;\n\n                op = exp[i];\n            } else if (i == exp.size() - 1) {\n\n                td = stoi(s + exp[i]);\n                s = "";\n\n                ll lcm = (de * 1ll * td) / (__gcd(de, td));\n                ll upnu = nu * (lcm / de);\n                ll tnu = tn * (lcm / td);\n\n                if (op == \'+\') {\n                    nu = upnu + tnu;\n                } else {\n                    nu = upnu - tnu;\n                }\n                de = lcm;\n\n                ll hcf = abs(__gcd(nu, de));\n\n                nu /= hcf;\n                de /= hcf;\n\n            } else if (exp[i] == \'/\') {\n                tn = stoi(s);\n                s = "";\n            } else {\n                s += exp[i];\n            }\n\n            i++;\n        }\n        s = "";\n        s += to_string(nu);\n        s += \'/\';\n        s += to_string(de);\n        return s;\n    }\n};\n```\n\n---\n\n\n\n> please ***Upvote,thank you*** guys\n\n---\n\n\n# I hope it helped you :)
['C++']