• + 0 comments

    Javascript solution: Loop until the n finding the Even numbers and multiply the current tree height by 2 else add 1 for the tree height

        // Write your code here
        let s = 1
        for(let i =0; i<n; i++){
          if(i%2 == 0) s *= 2
          else s+= 1
        }
        return s