Amazon interview question

write dynamic programming for recursion