We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 22b399c commit 32a8777Copy full SHA for 32a8777
medium/binary_tree_lca.js
@@ -33,7 +33,7 @@ function binaryTreeLca(strArr) {
33
34
// Find LCA
35
for (let i = 0; i < nodeAPath.length; i++) {
36
- if (nodeBPath.includes(nodeAPath[i])) {
+ if (nodeBPath.includes(nodeAPath[i]) && nodeAPath[i] !== '#') {
37
return Number(nodeAPath[i]);
38
}
39
0 commit comments