Given an integer num in the range [1, 3999], convert it to a Roman numeral string.
Roman numeral symbols and their values:
| Symbol | Value | |--------|-------| | M | 1000 | | CM | 900 | | D | 500 | | CD | 400 | | C | 100 | | XC | 90 | | L | 50 | | XL | 40 | | X | 10 | | IX | 9 | | V | 5 | | IV | 4 | | I | 1 |
Roman numerals are formed by greedily choosing the largest possible symbol at each step.
num = 3749"MMMDCCXLIX"num = 58"LVIII"num = 1994"MCMXCIV"1 <= num <= 3999Run your code to see results
Use Cmd+Enter to run