LeetCode 13.Roman to Integer

13. Roman to Integer

Given a roman numeral, convert it to an integer.

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

这道题,是要我们将罗马数字转换成十进制数字,属于一道水题,就不过多的介绍了,直接上代码了。

java代码:

class Solution {
    public int romanToInt(String s) {
        int i, total, pre, cur;
        total = charToInt(s.charAt(0));
        for(i = 1;i

你可能感兴趣的:(LeetCode 13.Roman to Integer)