Roman to Integer
Given a roman numeral, convert it to an integer.
Input is guaranteed to be within the range from 1 to 3999.
SOLUTION 1:
思路:
从后往前遍历罗马数字,如果某个数比前一个数小,则把该数在结果中减掉;
反之,则在结果中加上当前这个数;
View Code
GITHUB 代码:
https://github.com/yuzhangcmu/LeetCode_algorithm/blob/master/string/RomanToInt.java