easy - accepted / - tried
This is reverse of 133. roman numerals to integer
Roman numerals are represented by combinations of following seven symbols, each with a fixed integer value.
For Standard form, subtractive notation is used, meaning 4 is
IV rather than
IIII, 9 is
IX rather than
VIIII. Same rule applies to 40(
XL) and 900(
Simply speaking, the roman numerals in standard form follow these rules.
- symbols are listed from highest to lowest, from left to right
- from left to right, if the next symbol value is bigger than current one, it means subtracting, otherwise adding.
integerToRoman(). The input are all integers within valid range.
integerToRoman(123) // 'CXXIII' integerToRoman(1999) // 'MCMXCIX' integerToRoman(3420) // 'MMMCDXX'
Let's try to solve this problem within 10 minutes.