problem link: https://www.spoj.com/problems/DSUBSEQ/
basically the logic of program is
dp[i] = (2* dp[i-1]) % 10^9+7 (possibility of limit exceed of int)
if( arr[i] already occur in string)
dp[i] = dp[i] - dp[last occur index] (since we are substracting i don’t think it exceed int)
ans is == > dp[string length]
Constraints:
1<=t<=100
1<=length of s<=100000
s will contain upper letters only.
i don’t under stand why (a-b)%m = ((a%m)-(b%m)+m)%m) works here.
without it i don’t passed all testcases why?