Roman To Integer InterviewBit Solution

Problem: Roman To Integer

Problem Description:

Given a string A representing a roman numeral. Convert A into an integer.

A is guaranteed to be within the range from 1 to 3999.

Input Format

The only argument given is string A. 

Output Format

Return an integer which is the integer verison of roman numeral string. 

For Example

Input 1:
    A = "XIV"
Output 1:

Input 2:
    A = "XX"
Output 2:

Solution Approach:

The approach to this problem is quite straightforward, you just need to understand how Roman Numeral Systems is assigned to a number.

Time Complexity:

We are iterating the string only, so time complexity would be O(N)

Solution in C++: