I have read the solution for this problem but still have doubts about how the solution works.
Why doesnt dp[i][j] depend upon dp[i-1][j] and dp[i][j-1]
why does dp[i][j] only depend on dp[i-1][j-1]
Solution link: https://leetcode.com/problems/count-substrings-that-differ-by-one-character/discuss/1523218/C%2B%2B-DP-(Detailed-Explanation-with-Examples)