Converts Figure to Word

Based on Recursion and Memoization
    Boundaries:
  • - Not more than 999 Trillion
  • - Whole numbers only
  • - Negative number unneccessary

Overview

This project is implemented by the application of two very useful productivity concepts:

  • Recursion - A divide and conquer strategy that solves a problem by solving a smaller instance of it until a base case is reached. Keeping the code DRY (Don't Repeat Yourself)
  • Memoization - An optimization technique that is a space-time tradeoff. A techique that invest in computer memory for speed.

My Strategy

In my quest to tackle this problem, three word forms are identified and as follows:

  • Unique numbers: Numbers whose word form are unique and cannot be derived such as one, two, seven, eleven etc
  • Derived numbers: Numbers whose word form are derived e.g twenty-one from twenty and one
  • Mixed numbers: Combination of unique and derived numbers like one hundred from one (derived) and hundred (unique)

All unique numbers are mapped to a dictionary forming the base for derived and mixed word forms.

As the numbers grow, a pattern is identified which is a good case for recursive approach and since large numbers are involved, memoization is applied to cache repeatable computations.

Documentation