8 almost works

master
Matthew Huntington 3 years ago
parent 782bb1d9bc
commit 40bcb50cdd

@ -39,7 +39,7 @@ const breakDown = (node)=>{
return node; return node;
} }
const tree = breakDown({value:9}); const tree = breakDown({value:8});
console.dir(tree, {depth:null}); console.dir(tree, {depth:null});
@ -72,8 +72,13 @@ const getLeaves = (node)=>{
threePathResult[0] = threePathLeftValue; threePathResult[0] = threePathLeftValue;
threePathResult[1] = threePathRightValue; threePathResult[1] = threePathRightValue;
} else { } else {
threePathResult[0] = threePathLeftValue; if(Number.isInteger(threePathRightValue[0])){
threePathResult = threePathResult.concat(threePathRightValue); threePathRightValue.unshift(threePathLeftValue);
} else {
threePathRightValue[0].unshift(threePathLeftValue)
threePathRightValue[1].unshift(threePathLeftValue);
}
threePathResult = threePathRightValue;
} }
} }

Loading…
Cancel
Save