illuminati
1 min
Problem: Roman To Integer
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.
The only argument given is string A.
Return an integer which is the integer verison of roman numeral string.
Input 1:
A = "XIV"
Output 1:
14
Input 2:
A = "XX"
Output 2:
20
The approach to this problem is quite straightforward, you just need to understand how Roman Numeral Systems is assigned to a number.
We are iterating the string only, so time complexity would be O(N)