Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e82a361

Browse files
update 22
1 parent 0e228de commit e82a361

File tree

1 file changed

+4
-4
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+4
-4
lines changed

src/main/java/com/fishercoder/solutions/_22.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ public List<String> generateParenthesis(int n) {
3333
if (n == 0) {
3434
return result;
3535
}
36-
helper(result, "", n, n);
36+
backtrack(result, "", n, n);
3737
return result;
3838
}
3939

40-
void helper(List<String> result, String par, int left, int right) {
40+
void backtrack(List<String> result, String par, int left, int right) {
4141
if (left > 0) {
42-
helper(result, par + "(", left - 1, right);
42+
backtrack(result, par + "(", left - 1, right);
4343
}
4444
if (right > left) {
45-
helper(result, par + ")", left, right - 1);
45+
backtrack(result, par + ")", left, right - 1);
4646
}
4747
if (right == 0) {
4848
result.add(par);

0 commit comments

Comments
 (0)