Hint Only, you can solve it on your own :)
Intuition\n Describe your first thoughts on how to solve this problem. \nHey Coder, Dont\'t look for solution. Just let me give you a good hint, suppose the str
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nHey Coder, Dont\'t look for solution. Just let me give you a good hint, suppose the string is "[]" the ans will be zero right, and for every other balanced pair answer is going to be zero, and the unbalanced string can only be of this form "]]]]....[[[[...", now try to find out answer for size of 2,4,6,8 etc of this type of string , there is a pattern you will understand quickly.\n\nHope this helped. but if you need further help, I have added c++ code below :)\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int minSwaps(string s) {\n        stack<char> st ;\n        int count = 0  ;\n        for(int i = 0 ; i < s.size() ; i++){\n            if(s[i] == \'[\'){\n                st.push(s[i]) ;\n            }else{\n                if(!st.empty() && st.top() == \'[\') st.pop() ;\n                else st.push(s[i]) ;\n            }\n        }\n        count = st.size() ;\n        return ceil(count/4.0) ;\n    }\n};\n```
['Two Pointers', 'String', 'Stack', 'Greedy', 'C++']