| 10 | #include "kth_balances_bracket_multiple.h" |
| 11 | |
| 12 | bool balanced(string s) { |
| 13 | stack<char> st; |
| 14 | for (char c : s) { |
| 15 | if (c == '(' || c == '[') { |
| 16 | st.push(c); |
| 17 | } else { |
| 18 | if (st.empty()) |
| 19 | return false; |
| 20 | if (c == ')' && st.top() != '(') |
| 21 | return false; |
| 22 | if (c == ']' && st.top() != '[') |
| 23 | return false; |
| 24 | st.pop(); |
| 25 | } |
| 26 | } |
| 27 | return st.empty(); |
| 28 | } |
| 29 | |
| 30 | void find_all_permutation(string s, vector<string> & all) { |
| 31 | do { |
no outgoing calls
no test coverage detected