Adding caching for the recursive solution.

Speed up from O(2^n) to O(n)
Merge pull request #1 from Strikeskids/patch-1

Adding caching for the recursive solution.