Roman To Integer

Convert a roman numeral to an integer.

Medium5/28/2024

Problem statement

Given a roman numeral as a string, convert it to an integer.

Examples:

  • III -> 3
  • IV -> 4
  • IX -> 9
  • LVIII -> 58
  • MCMXCIV -> 1994

The input is guaranteed to be a valid roman numeral in the range [1, 3999].

Problem leaderboard

#
Size
%
Users
#1
62 c.
Top 22%
Steffan
sean
#2
87 c.
Top 33%
voytxt
#3
105 c.
Top 44%
SephQ
#4
106 c.
Top 67%
Thomasdcrt
maximec-indy
#5
132 c.
Top 78%
Mif712
#6
147 c.
Top 89%
madeforlosers
#7
195 c.
Top 100%
ComputerKWasTaken