• + 0 comments

    Go

    func utopianTree(n int32) int32 {
        var grow int32=1
        for i:=int32(1);i<=n;i++{
            if(i%2==0){
                grow++
            } else {
                grow=grow*2
            }
        }
        return grow
    }