Good Strings
You are given two integers n and d. Returns the numbers of Good Strings having length n and absolute difference between the adjacent characters 'a' to 'z' is not more than d.
a and z have absolute difference 25.
b and c have absolute difference 1.
GoodStrings has the following parameters:
n: The size of the string.d: The difference.
Returns
int number of Good Strings mod 10^9 + 7.
1Example 1
There are 124 Good Strings of length 2 where the absolute difference between adjacent characters is not more than 2.
2Example 2
There are 2596 Good Strings of length 3 where the absolute difference between adjacent characters is not more than 5.
Constraints
Limits and guarantees your solution can rely on.
n≤ 105d≤ 25