We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0e228de commit e82a361Copy full SHA for e82a361
src/main/java/com/fishercoder/solutions/_22.java
@@ -33,16 +33,16 @@ public List<String> generateParenthesis(int n) {
33
if (n == 0) {
34
return result;
35
}
36
- helper(result, "", n, n);
+ backtrack(result, "", n, n);
37
38
39
40
- void helper(List<String> result, String par, int left, int right) {
+ void backtrack(List<String> result, String par, int left, int right) {
41
if (left > 0) {
42
- helper(result, par + "(", left - 1, right);
+ backtrack(result, par + "(", left - 1, right);
43
44
if (right > left) {
45
- helper(result, par + ")", left, right - 1);
+ backtrack(result, par + ")", left, right - 1);
46
47
if (right == 0) {
48
result.add(par);
0 commit comments