✅✅C++ in O(n) Solution...Detailed...No In-built functions used.
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\nHere simple concept of LCM and GCD are used.\nAlso String is traversed in
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\nHere simple concept of LCM and GCD are used.\nAlso String is traversed in a way to first store elements of fractions in pair.\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(n)\n\n# Code\n```\nclass Solution {\npublic:\n    int lcm(int a,int b)\n    {\n        return (a/gcd(a,b))*b;\n    }\n    int gcd(int a,int b)\n    {\n        return b==0?a:gcd(b,a%b);\n    }\n    string fractionAddition(string expression) \n    {\n        if(expression[0]!=\'-\')\n        {\n            expression.insert(0,"+");\n        }\n        vector<pair<int,int>>numden;\n        bool leave=false,ispos=true;\n        int tempnum;\n        int i=0;\n        pair<int,int>temp;\n        while(1)\n        {\n            tempnum=0;\n            if(expression[i]==\'+\')\n            {\n                ispos=true;\n                i++;\n            }\n            else if(expression[i]==\'-\')\n            {\n                ispos=false;\n                i++;\n            }\n            while(expression[i]<=\'9\' && expression[i]>=\'0\')\n            {\n                tempnum*=10;\n                tempnum+=(int)(expression[i]-\'0\');\n                i++;\n                if(expression[i]==\'/\')\n                {\n                    i++;\n                    break;\n                }\n            }\n            if(ispos)\n            {\n                temp.first=tempnum;\n            }\n            if(!ispos)\n            {\n                temp.first=-tempnum;\n            }\n            tempnum=0;\n            while(expression[i]<=\'9\' && expression[i]>=\'0\')\n            {\n                tempnum*=10;\n                tempnum+=(int)(expression[i]-\'0\');\n                i++;\n                if(i==expression.size())\n                {\n                    leave=true;\n                    break;\n                }\n                if(expression[i]==\'+\' || expression[i]==\'-\')\n                {\n                    break;\n                }\n            }\n            temp.second=tempnum;\n            numden.push_back(temp);\n            if(leave)\n            {\n                break;\n            }\n        }\n        string ans;\n        for(i=0;i<numden.size();i++)\n        {\n            int GCD=gcd(abs(numden[i].first),abs(numden[i].second));\n            numden[i].first/=GCD;\n            numden[i].second/=GCD;\n        }\n        int LCM=numden[0].second;\n        for(i=1;i<numden.size();i++)\n        {\n            LCM=lcm(LCM,numden[i].second);\n        }\n        int deno=LCM;\n        int nume=0;\n        for(i=0;i<numden.size();i++)\n        {\n            nume+=(LCM*numden[i].first)/numden[i].second;\n        }\n        if(nume<0)\n        {\n            ans.push_back(\'-\');\n            nume=-nume;\n        }\n        int GCD=gcd(nume,deno);\n        nume/=GCD;\n        deno/=GCD;\n        string numerator,denominator;\n        if(nume==0)\n        {\n            numerator="0";\n        }\n        while(nume!=0)\n        {\n            numerator.push_back((char)(nume%10+48));\n            nume/=10;\n        }\n        reverse(numerator.begin(),numerator.end());\n        if(deno==0)\n        {\n            denominator="0";\n        }\n        while(deno!=0)\n        {\n            denominator.push_back((char)(deno%10+48));\n            deno/=10;\n        }\n        reverse(denominator.begin(),denominator.end());\n        ans.append(numerator);\n        ans.push_back(\'/\');\n        ans.append(denominator);\n        return ans;\n    }\n};\n```
['C++']