Belongs to memoization

 #25
I like eloy's solution, better readability.