diff --git a/src/main/java/com/fishercoder/solutions/_687.java b/src/main/java/com/fishercoder/solutions/_687.java index 577b1e37d0..fdefefa727 100644 --- a/src/main/java/com/fishercoder/solutions/_687.java +++ b/src/main/java/com/fishercoder/solutions/_687.java @@ -47,7 +47,9 @@ public int longestUnivaluePath(TreeNode root) { } return result[0]; } - + + // calculate longest univalue path from root to leaves + // In addition, the maximum univalue path cross the root node is calculated and then global maximum is udpated. private int dfs(TreeNode root, int[] result) { int leftPath = root.left == null ? 0 : dfs(root.left, result); int rightPath = root.right == null ? 0 : dfs(root.right, result);