This code is giving Runtime error , but i can't figure out why ? Instead of too much debugging i can't figure out why?

@aryan_007 i think calling min() function simultaneoulsy is causing error for big values try this way to fill up your dp table
int dp[n];
dp[0]=a[0];
dp[1]=a[1];
dp[2]=a[2];
for(int i=3;i<n;i++){
dp[i]=INT_MAX;
for(int j=0;j<3;j++){
dp[i]=min(dp[i],a[i]+dp[i-j-1]);
}
}

Sir , Before this i have one more doubt , i usually get this kind of error in my sublime text while sometimes this error don’t come , i couldn’t figure out why ? But my same code is running fine on online ide .

And sir for large values also why should this would give error , i have used the same many times on codeforces but it never gave error there

sorry i don’t use sublime so i can’t help you here.

yeah your code is correct it shouldn’t give any error but sometimes it depends upon ide to ide and as per test cases.

Still getting Runtime error !!