• + 0 comments
    function utopianTree(n) {
        
        var height = 1
        var double_hight_growth = true
        
        for (var i = 1; i <=n ;i++){
            
            if (double_hight_growth){
                
                double_hight_growth = false
                height =  2 * height
                
            }
            else{
                
                double_hight_growth = true
                height = height + 1
            }
            
            
        }
        return height
    
    }