Skip to content

Latest commit

 

History

History
32 lines (19 loc) · 587 Bytes

File metadata and controls

32 lines (19 loc) · 587 Bytes

Factorial with Memoizing

Question

Illustrate finding the factorial of a given number, which memoizes the intermediate results.

Solution

.. literalinclude:: ../../languages/python/algorithm_fact_with_memo.py
   :language: python
   :tab-width: 4

.. runcode:: ../../languages/python/algorithm_fact_with_memo.py
   :language: python
   :codesite: ideone

Explanation

.. seealso::

   * :python-suggest-improve:`algorithm_fact_with_memo.py`
   * :python-better-explain:`algorithm_fact_with_memo.rst`