C++ || O(N) solution || Stack and observation
\nint minSwaps(string s) {\n        //Creating a stack and remove all possible occ. of []\n        stack<char> st;\n        for(auto i:s) {\n            if(i==\
```\nint minSwaps(string s) {\n        //Creating a stack and remove all possible occ. of []\n        stack<char> st;\n        for(auto i:s) {\n            if(i==\'[\')\n                st.push(i);\n            else {\n                if(!st.empty() && st.top()==\'[\')\n                    st.pop();\n                else \n                    st.push(i);\n            }\n        }\n\t\t//Count the number of opening and closing bracs\n        int openingBracket = 0, closingBracket = 0;\n        while(!st.empty()) {\n            int top = st.top();\n            if(top==\'[\') openingBracket++;\n            else closingBracket++;\n            st.pop();\n        }\n\t\t//Type -> ]]]][[[[\n        return ((openingBracket+1)/2 + (closingBracket+1)/2)/2;\n\t\t\n    }\n```\nIf you find this solution helpful, do upvote it and if any doubts, then do ask in the comments, I\'ll surely answer your query :)
['Stack', 'C']