MCPcopy Create free account
hub / github.com/Ainevsia/Leetcode-Rust / bt

Method bt

22. Generate Parentheses/Solution.cpp:53–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
72int main() {

Callers 1

generateParenthesisMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected