package
Version:
v0.0.0-...-899dd15
Opens a new window with list of versions in this module.
Published: Sep 11, 2020
License: MIT
Opens a new window with license information.
Imports: 0
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
题目
Given a roman numeral, convert it to an integer.
Input is guaranteed to be within the range from 1 to 3999.
解题思路
这一题是12. Integer to Roman的一个逆转换。一样的解题思路
此题,最关键的信息是
右加左减,左减数字必须为一位,比如8写成VIII,而非IIX。
解题思路
- 从右往左处理字符串。
- 当前字符代表的数字,小于右边字符的时候,总体减去当前字符代表的数字。
- 否则,总体加上当前字符代表的数字。
总结
抓住关键信息,避免思维定式。
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.