Skip to content

Commit 826c876

Browse files
refactor 543
1 parent 4c2221c commit 826c876

File tree

1 file changed

+4
-0
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+4
-0
lines changed

src/main/java/com/fishercoder/solutions/_543.java

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ public class _543 {
66

77
public static class Solution1 {
88
/**
9+
* A great observation of this problem is that the longest path must exist between two leaf nodes,
10+
* since it's easy to prove its opposite is not the longest by simply adding one to reach its leaf node.
11+
*
12+
* <p>
913
* This is a very great problem for practicing recursion:
1014
* 1. What dfs() returns is the max height it should pick from either its left or right subtree, that's
1115
* what the int return type stands for;

0 commit comments

Comments
 (0)