dynamic programming implementation for spoj/party
Initialize OPT[0,c] = 0, for c = 0..C and OPT[i,0], for i= 0..n | |
For i = 1,...,n do | |
For c = 1,..,C do | |
Use above recurrence to compute OPT(i,c) | |
Return OPT(n,C) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment