We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4c2221c commit 826c876Copy full SHA for 826c876
src/main/java/com/fishercoder/solutions/_543.java
@@ -6,6 +6,10 @@ public class _543 {
6
7
public static class Solution1 {
8
/**
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>
13
* This is a very great problem for practicing recursion:
14
* 1. What dfs() returns is the max height it should pick from either its left or right subtree, that's
15
* what the int return type stands for;
0 commit comments