Skip to content

Commit 86ad763

Browse files
committed
Add solution #13
1 parent 77c98ab commit 86ad763

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

solutions/0013-roman-to-integer.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
* https://leetcode.com/problems/roman-to-integer/
44
* Difficulty: Easy
55
*
6-
* Roman numerals are represented by seven different symbols: `I`, `V`, `X`, `L`, `C`, `D` and `M`.
6+
* Roman numerals are represented by seven different symbols: `I`, `V`, `X`,
7+
* `L`, `C`, `D` and `M`.
78
*
89
* Symbol Value
910
* I 1
@@ -14,13 +15,15 @@
1415
* D 500
1516
* M 1000
1617
*
17-
* For example, `2` is written as `II` in Roman numeral, just two one's added together. `12` is written
18-
* as `XII`, which is simply `X + II`. The number `27` is written as `XXVII`, which is `XX + V + II`.
18+
* For example, `2` is written as `II` in Roman numeral, just two one's
19+
* added together. `12` is written as `XII`, which is simply `X + II`.
20+
* The number `27` is written as `XXVII`, which is `XX + V + II`.
1921
*
20-
* Roman numerals are usually written largest to smallest from left to right. However, the numeral for
21-
* four is not `IIII`. Instead, the number four is written as `IV`. Because the one is before the five
22-
* we subtract it making four. The same principle applies to the number nine, which is written as `IX`.
23-
* There are six instances where subtraction is used:
22+
* Roman numerals are usually written largest to smallest from left to right.
23+
* However, the numeral for four is not `IIII`. Instead, the number four is
24+
* written as `IV`. Because the one is before the five we subtract it making
25+
* four. The same principle applies to the number nine, which is written as
26+
* `IX`. There are six instances where subtraction is used:
2427
*
2528
* - `I` can be placed before `V (5)` and `X (10)` to make 4 and 9.
2629
* - `X` can be placed before `L (50)` and `C (100)` to make 40 and 90.

0 commit comments

Comments
 (0)