NewsCred Interview Question

How to compute a factorial? How do it in a way that saves the previously computed values (cacheing)