Roman to Integer Problem
Roman to Integer Problem — ExecCode School DSA Practice
Solve the Roman to Integer problem on ExecCode. Free online school DSA practice in Math. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Roman numerals are represented by seven symbols: I(1), V(5), X(10), L(50), C(100), D(500), M(1000). Given a roman numeral string, convert it to an integer.
Examples
Input s = "III"; Output 3. Input s = "IV"; Output 4. Input s = "MCMXCIV"; Output 1994
Constraints
1 ≤ s.length ≤ 15 s contains only valid roman numeral characters.
Practice Roman to Integer free on ExecCode. Browse DSA problems, topic map, and placement guides.