 New update is available. Click here to update.

# Roman Numeral To Integer

Last Updated: 18 Dec, 2020
Difficulty: Easy

## PROBLEM STATEMENT

#### Roman numerals are represented by seven different symbols: I, V, X, L, C, D, and M.

##### Table of values:
``````Symbol       Value
I             1
V             5
X             10
L             50
C             100
D             500
M             1000
``````
##### For example:
``````3 is written as III in Roman numeral, just three ones added together. 13 is written as XIII, which is simply X + III. The number 25 is written as XXV, which is XX + V
``````
##### Note:
``````Do not print anything, just return an integer denoting the equivalent integer of the given roman number

It is guaranteed that the string input is one of the characters of I, V, X, L, C, D, M.

It is guaranteed that the integer value of the given roman number will not exceed 3999.
``````
##### Input format:
``````The first line of input contains an integer ‘T’ denoting the number of test cases.
The next ‘T’ lines represent the ‘T’ test cases.

The first line of each test case contains a string ‘roman’ representing the number's roman number representation.
``````
##### Output Format
``````For each test case, return a single integer denoting the integer value of the given roman number.
``````
##### Constraints:
``````1 <= T <= 50
1 <= roman.length <= 15

Time limit: 1 second
``````
SIMILAR PROBLEMS

Cakes

Posted: 23 Sep, 2022
Difficulty: Easy

1-3 Palindrome

Posted: 4 Oct, 2022
Difficulty: Easy

Longest Subarray With Zero Sum

Posted: 3 Nov, 2022
Difficulty: Moderate

Maximum GCD

Posted: 8 Dec, 2022
Difficulty: Hard

8-Queen Problem

Posted: 19 Dec, 2022
Difficulty: Easy