dp[n][k] = dp[n][k-1]+dp[n-1][k]-dp[n-1][k-n] since this is your formula.
Why dp[i][j] can equals to "dp[i][j-1] + dp[i-1][j]; "
Should we prove that
dp[n][k] = dp[n][k-1]+dp[n-1][k] ?
K Inverse Pairs Array
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.