time limit exceeding for last test case. What time complexity we need to follow to successfully get the output.
Prime visits question
@Himanshu-Sajwan-2271264282963988 hey Himanshu can you please share your implementation so that I can help you asap
#include using namespace std; int main() { int t; cin>>t; while(t–) { int n,m,i,z,j,g=0,c=0; cin>>n>>m; int a[m]; for(i=0;i<=m;i++) {a[g++]=i; if(i==0||i==1) a[g-1]=-1; } for(i=2;i<g/2;i++) {z=a[i]; if(z<=0) continue; else { for(j=i+1;j<g;j++) { if(a[j]<=0) continue; else { if(a[j]%z==0) a[j]=-1; } } } } for(i=n;i<=m;i++) if(a[i]!=-1)c++; cout<<c<<"\n"; } return 0; }