We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fc38c9b commit ae927f5Copy full SHA for ae927f5
src/main/java/com/fishercoder/solutions/_1676.java
@@ -47,7 +47,7 @@ public static class Solution2 {
47
*/
48
public TreeNode lowestCommonAncestor(TreeNode root, TreeNode[] nodes) {
49
TreeNode ans = nodes[0];
50
- for (int i = 0; i < nodes.length; i++) {
+ for (int i = 1; i < nodes.length; i++) {
51
ans = lca(root, ans, nodes[i]);
52
}
53
return ans;
0 commit comments