Skip to content

Commit a663226

Browse files
authored
Update 894-all-possible-full-binary-trees.js
1 parent d50091b commit a663226

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

894-all-possible-full-binary-trees.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,8 @@
1010
* @return {TreeNode[]}
1111
*/
1212
const allPossibleFBT = function(N) {
13-
if (N <= 0) {
14-
return []
15-
}
16-
const dp = new Array(N + 1)
17-
for (let i = 0; i <= N; i++) {
18-
dp[i] = []
19-
}
13+
if (N <= 0) return []
14+
const dp = Array.from({ length: N + 1 }, () => [])
2015
dp[1].push(new TreeNode(0))
2116

2217
for (let numNode = 1; numNode <= N; numNode += 2) {

0 commit comments

Comments
 (0)