Convert an integer (1-3999) to its Roman numeral representation
Greedy (Value Table)
Digit Mapping
ROMAN NUMERAL
—
Value-Symbol Reference Table
ROMAN NUMERAL
—
Digit Mapping Approach:
Predefine Roman representations for each digit (0-9) at each place value (thousands, hundreds, tens, ones).
Decompose the number into its digits and look up each one.
Example: 1994 = thousands[1] + hundreds[9] + tens[9] + ones[4]
= M + CM + XC + IV = MCMXCIV