Movatterモバイル変換


[0]ホーム

URL:


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

Commitd3f0c86

Browse files
authored
Create 94-binary-tree-inorder-traversal.js
Solved binary-tree-inorder-traversal in JS.
1 parent3cfb9a5 commitd3f0c86

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// problem link https://leetcode.com/problems/binary-tree-inorder-traversal/
2+
// time complexity O(n) // whatever the number of nodes are.
3+
4+
varinorderTraversal=function(root){
5+
6+
if(!root)return[];
7+
constresult=[];
8+
9+
functiongoRecursive(root){
10+
11+
if(!root)return;
12+
goRecursive(root.left);
13+
result.push(root.val);
14+
goRecursive(root.right);
15+
}
16+
goRecursive(root);
17+
returnresult;
18+
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp