• + 0 comments

    Php solution;

    function utopianTree($n) {
        // Write your code here
        $height = 1;
        for($i = 1; $i <= $n; $i++) {
            // is summer
            if ($i % 2 == 0) {
                $height += 1;
            } else {
                // is spring
                $height *= 2; 
            }
        }
        return $height;
    }