Roman numeral to integer
Question
Given a Roman numeral string, write a function that returns the corresponding integer value. Keep in mind that Roman numerals also use subtractive notion, for example, IV corresponds to 4.
Below are the values for Roman numerals:
Symbol | Value |
---|---|
I | 1 |
V | 5 |
X | 10 |
L | 50 |
C | 100 |
D | 500 |
M | 1000 |