Roman to Integer Problem

Roman to Integer Problem — ExecCode Easy DSA Practice

Solve the Roman to Integer problem on ExecCode. Free online easy DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Roman numerals are represented by seven symbols. Given a roman numeral string, convert it to an integer. Subtractive pairs like IV=4 and IX=9 must be handled.

Examples

Input s = "MCMXCIV"; Output 1994

Constraints

1 ≤ s.length ≤ 15 s contains only I,V,X,L,C,D,M It is guaranteed s is a valid roman numeral in range [1, 3999]

Practice Roman to Integer free on ExecCode. Browse DSA problems, topic map, and placement guides.