C++ Solution || Minimum Number of Swaps to Make the String Balanced
\nclass Solution {\npublic:\n    int minSwaps(string s) {\n        stack<char> st;\n        int count = 0;\n        //remove all balanced paranthesis\n        f
```\nclass Solution {\npublic:\n    int minSwaps(string s) {\n        stack<char> st;\n        int count = 0;\n        //remove all balanced paranthesis\n        for(int i = 0 ; i < s.length() ; i++){\n            if(s[i] == \'[\')\n                st.push(s[i]);\n            else\n            {\n                if(!st.empty() && st.top() == \'[\')\n                    st.pop();\n                else\n                    count++;\n            }\n        }\n        //remaining only unbalanced paranthesis\n        int ans = (count + 1) / 2;\n        return ans;\n    }\n};\n```
['Stack', 'C']