Very Easy 4 Line Solution
Complexity\n- Time complexity:O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:O(1)\n Add your space complexity here, e.g. O(n) \n\n# Code
# Complexity\n- Time complexity:O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int minSwaps(string s) {\n        int ans = 0;\n        for(char ch:s){\n            if(ch == \'[\') ans++;\n            else if(ans>0) ans--;\n        }\n        return (ans+1)/2;\n    }\n};\n```
['String', 'Greedy', 'C++']