Roman to Integer 题解
Last updated
Was this helpful?
Last updated
Was this helpful?
题目来源:
> Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999.
解题思路:
IV, I比V对应的数值小,结果就是result + (-I),不然就是直接加 I.
学习下
末尾加个0,让串都解析完毕。