Count Subsequences dynamic programming

Question is passing given test cases but is not getting submitted.

Hello @poorva2145,

  1. I have done few changes in your code make your code memory efficient:
    https://ide.codingblocks.com/s/165172

  2. Your code is logically correct.
    Please, post this issue at [email protected].
    Tech team would soon look into the matter.

Hope, this would help.

1 Like

Sir even it is not accepting this code. I have mailed them regarding the issue. Thank you.

@poorva2145 @S18ML0016
There was a slight backend issue with this problem. I have updated the testcases for this problem. Try submitting it once again.
Also , modify the statements
dp[i+1] = dp[i+1] - dp[index];
dp[i+1] = dp[i+1]%1000000007;

to
dp[i+1] = ( dp[i+1] - dp[index] + MOD ) % MOD;
where MOD = 1000000007

to account for the negative values.

Try submitting your code again.

1 Like