http://www.spoj.com/problems/ASSIGN/ I did solve this problem using up-down approach with memoization, but memory required is 2^20. is there any memory efficient way or how to solve when value of N is increased?? The web resources are also of memory O(2^20)
It uses 4MB memory
UPD : I read it wrong. Ignore.