Skip to content

Commit

Permalink
update 100 java, progress
Browse files Browse the repository at this point in the history
  • Loading branch information
yennanliu committed May 15, 2024
1 parent b8e18dd commit c264783
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 10 deletions.
2 changes: 1 addition & 1 deletion data/progress.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
20240515: 104,230,102
20240515: 104,230,102,100
20240514: 105,106
20240513: 242,235
20240512: 371
Expand Down
18 changes: 9 additions & 9 deletions data/to_review.txt
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
2024-07-09 -> ['104,230,102']
2024-07-09 -> ['104,230,102,100']
2024-07-08 -> ['105,106']
2024-07-07 -> ['242,235']
2024-07-06 -> ['371']
2024-07-05 -> ['121,252']
2024-07-04 -> ['125']
2024-06-18 -> ['104,230,102']
2024-06-18 -> ['104,230,102,100']
2024-06-17 -> ['105,106']
2024-06-16 -> ['242,235']
2024-06-15 -> ['371']
2024-06-14 -> ['121,252']
2024-06-13 -> ['125']
2024-06-05 -> ['104,230,102']
2024-06-05 -> ['104,230,102,100']
2024-06-04 -> ['105,106']
2024-06-03 -> ['242,235']
2024-06-02 -> ['371']
2024-06-01 -> ['121,252']
2024-05-31 -> ['125']
2024-05-28 -> ['104,230,102']
2024-05-28 -> ['104,230,102,100']
2024-05-27 -> ['105,106']
2024-05-26 -> ['242,235']
2024-05-25 -> ['371']
2024-05-24 -> ['121,252']
2024-05-23 -> ['104,230,102', '125']
2024-05-23 -> ['104,230,102,100', '125']
2024-05-22 -> ['105,106']
2024-05-21 -> ['242,235']
2024-05-20 -> ['104,230,102', '371']
2024-05-20 -> ['104,230,102,100', '371']
2024-05-19 -> ['105,106', '121,252']
2024-05-18 -> ['104,230,102', '242,235', '125']
2024-05-17 -> ['104,230,102', '105,106', '371']
2024-05-16 -> ['104,230,102', '105,106', '242,235', '121,252']
2024-05-18 -> ['104,230,102,100', '242,235', '125']
2024-05-17 -> ['104,230,102,100', '105,106', '371']
2024-05-16 -> ['104,230,102,100', '105,106', '242,235', '121,252']
2024-05-15 -> ['105,106', '242,235', '371', '125']
2024-05-14 -> ['242,235', '371', '121,252']
2024-05-13 -> ['371', '121,252', '125']
Expand Down
19 changes: 19 additions & 0 deletions leetcode_java/src/main/java/LeetCodeJava/Recursion/SameTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,25 @@ public class SameTree {
// IDEA : RECURSION
public boolean isSameTree(TreeNode p, TreeNode q) {

if (p == null && q == null) {
return true;
}

if (q == null || p == null){
return false;
}
if (p.val != q.val){
return false;
}

return this.isSameTree(p.left, q.left) &&
this.isSameTree(p.right, q.right);
}

// V0
// IDEA : RECURSION
public boolean isSameTree_0(TreeNode p, TreeNode q) {

if (p == null && q == null){
return true;
}
Expand Down
23 changes: 23 additions & 0 deletions leetcode_java/src/main/java/dev/workspace3.java
Original file line number Diff line number Diff line change
Expand Up @@ -456,5 +456,28 @@ public class MyQueue{
}
}

// LC 100
public boolean isSameTree(TreeNode p, TreeNode q) {

// if (q == null && q == null){
// return true;
// }

if (p == null && q == null) return true;

// if ((p == null && q != null) || (p != null && q == null)){
// return false;
// }
if (q == null || p == null){
return false;
}
if (p.val != q.val){
return false;
}

return this.isSameTree(p.left, q.left) &&
this.isSameTree(p.right, q.right);
}


}

0 comments on commit c264783

Please sign in to comment.