Getting TLE on this question

I implemented the question using recursion. I am not able to implement DP or memoization
Here is the link to my code https://ide.codingblocks.com/s/140354

Hi

if(alt){
//op[ind] = β€˜1’;
alt = !alt;
//cout << alt << endl;
getStringCount(ind+1,n,alt);
}
//op[ind] = β€˜0’;
alt = !alt;
getStringCount(ind+1,n,alt);

is this correct?
I think if statement does not make any difference

To convert it into DP
Look at the states you are using in the recursive function and make a DP state for each variable.
Try to do this.

( this should be your approach always to convert any recursive code into dp)
try this.

let me know further

Hit like if you get it.
Cheer!

Hi,
I implemented this problem using DP
I am now getting runtime error
also I am not getting any answer on input 90 on the judge but I am getting answer on my local compiler
Do let me know where I am getting wrong…
Here is my code https://ide.codingblocks.com/s/140502

hi

try to write this in c++ ?
and
ans[1][1] should be 0

Hi,
I implemented the logic in C++
All test cases passed
The Mathematical logic is clear,
But I am not getting it intuitively as I am not done with DP lectures and am a Beginner to DP
Please help me to understand the approach to DP.
The link to my code https://ide.codingblocks.com/s/140613