We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b2cefc3 commit 3559d84Copy full SHA for 3559d84
backtracking-algorithm.ts
@@ -2,7 +2,7 @@ function generateParantheses(n: number) {
2
const result: string[] = [];
3
4
function backtrack(combination = "", openCount = 0, closeCount = 0) {
5
- if (combination.length === 2 * n) collectedParanthesis.push(combination);
+ if (combination.length === 2 * n) result.push(combination);
6
7
if (openCount < n) {
8
backtrack(combination + "(", openCount + 1, closeCount);
0 commit comments