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

Commitbbf9d03

Browse files
committed
clean up code
1 parent4e45fb2 commitbbf9d03

File tree

3 files changed

+2
-13
lines changed

3 files changed

+2
-13
lines changed

‎Easy/104-maxDepth.js‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,6 @@
99
*@param {TreeNode} root
1010
*@return {number}
1111
*/
12-
// not accepted!!
13-
varmaxDepth=function(root){
14-
if(root===null){return0;}
15-
if(maxDepth(root.left)>maxDepth(root.right)){
16-
root=root.left;
17-
}else{
18-
root=root.right;
19-
}
20-
returnmaxDepth(root)+1;
21-
};
22-
23-
// accepted
2412
varmaxDepth=function(root){
2513
varmax=0;
2614
varlmax=maxDepth(root.left);

‎Easy/21-mergeSortedLists.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ var mergeTwoLists = function(l1, l2) {
4141
};
4242

4343
// discard first dummy node in the new list which contains the merged result.
44+
// this is good and straightforward
4445
varmergeTwoLists=function(l1,l2){
4546
varl3=newListNode();
4647
varl3Head=l3;

‎Easy/9-palindromeNumber.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var isPalindrome = function(x) {
1414
};
1515

1616
// 2nd solution
17-
//it is slower than 1st solution, however, it only needs to examine half of the number
17+
//It only needs to examine half of the number
1818
// just be careful if the number is has factor 10
1919
// also a good solution in case overflow happens
2020
varisPalindrome=function(x){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp