POJ#1745 Classic DP/Search. Complexity from 2^n to n*k. Rank:7863