Mystery of Fibonacci

Fibonacci sequence is a recursive sequence that depends on the following definition: Fib(N) = Fib(N-…

Click here to read the complete problem statement.

If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

Why My code is causing Runtime Error…I have used memoization and my code can even handle more then the contrain values!

#define MAX_SIZE 1000005
using namespace std;
long long int term[1000000];
int fib(int n){
    if (n <= 1)
        return n;
    if (term[n] != 0)
        return term[n];
    else {
        term[n] = (fib(n - 1) + fib(n - 2))%1000000007;
        return term[n];
int main(){
    int n;

I have added all the headers but couldn’t pasted that properly…

@Being_Gorom you can also share your submission link like this