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

Commitca696fa

Browse files
committed
update: 111
1 parent040e17e commitca696fa

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

‎README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ This is the solutions collection of my LeetCode submissions, most of them are pr
5454
|93|[Restore IP Addresses](https://leetcode.com/problems/restore-ip-addresses/)|[JavaScript](./src/restore-ip-addresses/res.js)|Medium|
5555
|101|[Symmetric Tree](https://leetcode.com/problems/symmetric-tree/)|[JavaScript](./src/symmetric-tree/res.js)|Easy|
5656
|102|[Binary Tree Level Order Traversal](https://leetcode.com/problems/binary-tree-level-order-traversal/)|[JavaScript](./src/binary-tree-level-order-traversal/res.js)|Medium|
57+
|107|[Binary Tree Level Order Traversal II](https://leetcode.com/problems/binary-tree-level-order-traversal-ii/)|[JavaScript](./src/binary-tree-level-order-traversal-ii/res.js)|Easy|
5758
|120|[Triangle](https://leetcode.com/problems/triangle/)|[JavaScript](./src/triangle/res.js)|Medium|
5859
|121|[Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/)|[JavaScript](./src/best-time-to-buy-and-sell-stock/res.js)|Easy|
5960
|122|[Best Time to Buy and Sell Stock II](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/)|[JavaScript](./src/best-time-to-buy-and-sell-stock-ii/res.js)|Easy|
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* Definition for a binary tree node.
3+
* function TreeNode(val) {
4+
* this.val = val;
5+
* this.left = this.right = null;
6+
* }
7+
*/
8+
/**
9+
*@param {TreeNode} root
10+
*@return {number}
11+
*/
12+
varminDepth=function(root){
13+
if(!root)return0;
14+
15+
letqueue=[root];
16+
letres=1;
17+
18+
while(queue.length){
19+
consttempQ=[];
20+
letisNull=false;
21+
22+
queue.map(e=>{
23+
if(!e.left&&!e.right)isNull=true;
24+
25+
e.left&&tempQ.push(e.left);
26+
e.right&&tempQ.push(e.right);
27+
});
28+
queue=tempQ;
29+
if(isNull){
30+
break;
31+
}else{
32+
res+=1;
33+
}
34+
}
35+
36+
returnres;
37+
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp