C++,Easy to understand with Proper Explanation.
Daily Challenge:-15/03/2022.\nConcept:-We have to remove total of those braces which are invalid.\n-->Step1:- With the Help of stack store the indices of invali
# Daily Challenge:-15/03/2022.\n**Concept:**-We have to remove total of those braces which are invalid.\n-->**Step1:-** With the Help of stack store the indices of invalid braces.\n-->**Step2:-** Calculation to calculate the output result,by neglecting invalid braces indices which will present in stack.\n```\nclass Solution {\npublic:\n    string minRemoveToMakeValid(string s) {\n        /*Step1:-With the Help of Stack we are storing Indices of invalid braces.*/\n        stack<pair<char,int>>st;\n        string result="";\n        for(int i=0;i<s.size();i++)\n        {\n            if(s[i]==\'(\'||s[i]==\')\')\n            {\n                if(st.size()>0&&(st.top().first==\'(\'&&s[i]==\')\'))\n                    st.pop();\n                else\n                    st.push({s[i],i});\n            }\n        }\n        \n/*Step2:-As we know after the step 1 calculation,Stack will store the indices of invalid braces from right to left. Means stack top have indices of invalid braces which is in right most.\nThat\'s why itrating from right to left in string.\nIn side this Loop ,we are checking,wheather the ith index is invalid or not by comparing with stack top.\nif it is invalid then we didn\'t store it in our result,and we pop it from stack.\nOtherwise we store it in our resut.*/\n        for(int i=s.size()-1;i>=0;i--)\n        {\n            if(st.size()>0&&st.top().second==i)\n            {\n                st.pop();\n                continue;\n            }\n            else\n                result.push_back(s[i]);\n        }\n        \n        reverse(result.begin(),result.end()); //At the end reverse the answer.\n        return result; //return result \n    }\n};\n```\nIf you Find it helpful,please Upvote.
['Stack', 'C']