From 64fa180f6e7d22012915a9ae9dc7c6ed2e4f8720 Mon Sep 17 00:00:00 2001 From: Matthew Huntington Date: Wed, 19 Apr 2023 14:34:54 -0400 Subject: [PATCH] 7 works --- random.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/random.js b/random.js index 07cbaf9..2cf2b7f 100644 --- a/random.js +++ b/random.js @@ -77,7 +77,12 @@ const getLeaves = (node)=>{ if(threePathResult.length === 0){ return twoPathResult; } else { - return [twoPathResult, threePathResult] + if(Number.isInteger(twoPathResult[0])){ + return [twoPathResult, threePathResult] + } else { + twoPathResult.push(threePathResult) + return twoPathResult; + } } } const leaves = getLeaves(tree);