Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2521d1e

Browse files
docs: add new changelog and exercises
1 parent bc51a7a commit 2521d1e

File tree

5 files changed

+70
-5
lines changed

5 files changed

+70
-5
lines changed

‎CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Bug Fixes (patch)
1515

16+
## [1.3.9]
17+
18+
### Breaking Changes (major)
19+
20+
### New Features (minor)
21+
22+
### Bug Fixes (patch)
23+
- fix(book): fix table typos [commit](https://github.com/amejiarosario/dsa.js/commit/bc51a7a0c97aea9dea1afa5f8af22c0bed1382d3)
24+
1625
## [1.3.8]
1726

1827
### Breaking Changes (major)
@@ -134,7 +143,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
134143

135144
-
136145

137-
[Unreleased]: https://github.com/amejiarosario/dsa.js/compare/1.3.8...HEAD
146+
[Unreleased]: https://github.com/amejiarosario/dsa.js/compare/1.3.9...HEAD
147+
[1.3.9]: https://github.com/amejiarosario/dsa.js/compare/1.3.8...1.3.9
138148
[1.3.7]: https://github.com/amejiarosario/dsa.js/compare/1.3.7...1.3.8
139149
[1.3.6]: https://github.com/amejiarosario/dsa.js/compare/1.3.6...1.3.7
140150
[1.3.6]: https://github.com/amejiarosario/dsa.js/compare/1.3.5...1.3.6
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* https://leetcode.com/submissions/detail/313704254/
3+
* @param {number} n
4+
* @return {string[]}
5+
*/
6+
function generateParenthesis(n, result = [], open = 0, close = 0, curr = '') {
7+
if (curr.length === n * 2) {
8+
result.push(curr);
9+
} else {
10+
if (open < n) {
11+
generateParenthesis(n, result, open + 1, close, `${curr}(`);
12+
}
13+
if (close < n) {
14+
generateParenthesis(n, result, open, close + 1, `${curr})`);
15+
}
16+
}
17+
18+
return result;
19+
}
20+
21+
module.exports = generateParenthesis;
22+
23+
/*
24+
0: [""]
25+
1: ["()"]
26+
2: ["(())", "()()"]
27+
3: ["((()))", "()()()", "(())()", "()(())"]
28+
*/
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const generateParenthesis = require('./generate-parentheses');
2+
3+
describe('Generate Parenthesis', () => {
4+
it('should work with 0', () => {
5+
expect(generateParenthesis(1)).toEqual(expect.arrayContaining([
6+
]));
7+
});
8+
9+
it('should work with 1', () => {
10+
expect(generateParenthesis(1)).toEqual(expect.arrayContaining([
11+
'()',
12+
]));
13+
});
14+
15+
it('should work with 2', () => {
16+
expect(generateParenthesis(2)).toEqual(expect.arrayContaining([
17+
'(())',
18+
'()()',
19+
]));
20+
});
21+
22+
it('should work with 3', () => {
23+
expect(generateParenthesis(3)).toEqual(expect.arrayContaining(
24+
['((()))', '(()())', '(())()', '()(())', '()()()'],
25+
));
26+
});
27+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../01-arrays/powerset/powerset-backtrack.js

‎notes.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ git log <last tag> HEAD --pretty=format:%s
2222
# example
2323
git log 1.1.0..HEAD --pretty=format:%s
2424

25-
git log 1.3.6..HEAD --pretty=format:"- %s [commit](https://github.com/amejiarosario/dsa.js/commit/%H)" --grep "BREAKING CHANGE:"
26-
git log 1.3.6..HEAD --pretty=format:"- %s [commit](https://github.com/amejiarosario/dsa.js/commit/%H)" --grep "^feat.*:"
27-
git log 1.3.6..HEAD --pretty=format:"- %s [commit](https://github.com/amejiarosario/dsa.js/commit/%H)" --grep "^fix.*:"
25+
git log 1.3.8..HEAD --pretty=format:"- %s [commit](https://github.com/amejiarosario/dsa.js/commit/%H)" --grep "BREAKING CHANGE:"
26+
git log 1.3.8..HEAD --pretty=format:"- %s [commit](https://github.com/amejiarosario/dsa.js/commit/%H)" --grep "^feat.*:"
27+
git log 1.3.8..HEAD --pretty=format:"- %s [commit](https://github.com/amejiarosario/dsa.js/commit/%H)" --grep "^fix.*:"
2828
```
2929

3030
New features in this release
@@ -117,4 +117,3 @@ alert('foo');
117117
console.log('bar');
118118
/* eslint-enable no-alert */
119119
```
120-

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /