Test cases not passed

my code is correct according to answer

hello @singh.pankhil40
use dynamic programming. for this problem .
and long long in place of int

my friend has submitted the code and has given me test cases but when i run it on my code it give exactly same output

the issue is with ur solution time complexity.

it is O(t*2^n) which is huge.
thats why i m telling u to use dp to optimise it furthur

so sir it should give tle but why is it giving wrong answer

share ur code using cb ide.
i will try to submit it and will check why it is givng wa

https://online.codingblocks.com/app/player/133351/content/109045/5136/code-challenge

code…

can you tell me how to share code with you

#include <bits/stdc++.h>
using namespace std;
int coun=0;
void classassignment(int n,int a,int b,int *c,int j)
{if(j==n)
{coun++;
return;}
c[j]=a;
{classassignment(n,a,b,c,j+1);}
if(c[j-1]!=b)
{c[j]=b;
classassignment(n,a,b,c,j+1);}
}
int main()
{ int t=0;
cin>>t;
while(t–)
{int n=0;
cin>>n;
int c[100000]={0};
int j=0;
classassignment(n,1,2,c,j);
cout<<coun<<endl;
coun=0;
}
return 0;}


save it here .
and share the generated link with me

it is correct.
use long long and then try .