#include <string>
#include <vector>

using namespace std;

vector<long long> list;

void update_list(int n){
    int i;
    long long result=(3*list[n-1])%1000000007;
    for(i=1;i<n;i++){
        result+=(2*list[n-i-1])%1000000007;
    }
    //result
    list.push_back(result+2);
}

int solution(int n) {
    list.resize(0,0);
    int i;
    list.push_back(3);
    for(i=1;i<n/2;i++){
        update_list(i);
    }
    return list[list.size()-1]%1000000007;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: