| 51 | } |
| 52 | |
| 53 | void bt(vector<string> & v, int l, int r, string & str) { |
| 54 | if (l == 0 and r == 0) { |
| 55 | v.push_back(str); |
| 56 | return; |
| 57 | } |
| 58 | if (l > 0) { |
| 59 | str.push_back('('); |
| 60 | this->bt(v, l-1, r, str); |
| 61 | str.pop_back(); |
| 62 | } |
| 63 | if (r > l and r > 0) { |
| 64 | str.push_back(')'); |
| 65 | this->bt(v, l, r-1, str); |
| 66 | str.pop_back(); |
| 67 | } |
| 68 | return; |
| 69 | } |
| 70 | }; |
| 71 | |
| 72 | int main() { |