ksum

http://www.lintcode.com/en/problem/k-sum/#

KSUM problem could use recursive solution by reducing the problem to k-1 sum.

It also has a dp solution:

dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][target-A[i-1]]

Leave a comment