Skip to content

Instantly share code, notes, and snippets.

@adilakhter
Created February 16, 2013 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adilakhter/4968611 to your computer and use it in GitHub Desktop.
Save adilakhter/4968611 to your computer and use it in GitHub Desktop.
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