We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4b1196b commit 045d3fcCopy full SHA for 045d3fc
README.md
@@ -200,32 +200,7 @@ Explanation: M = 1000, CM = 900, XC = 90 and IV = 4.
200
- s contains only the characters ('I', 'V', 'X', 'L', 'C', 'D', 'M').
201
- It is guaranteed that s is a valid roman numeral in the range [1, 3999].
202
203
-## **Solution 1**
204
-
205
-```js
206
-var romanToInt = function (s) {
207
- let result = 0;
208
- const inputArray = Array.of(...s);
209
- const romanVal = { I: 1, V: 5, X: 10, L: 50, C: 100, D: 500, M: 1000 };
210
- const inputsVal = [];
211
212
- inputArray.forEach((item) => {
213
- inputsVal.push(romanVal[item]);
214
- });
215
216
- for (let i = 0; i < inputArray.length; i++) {
217
- if (inputsVal[i] < inputsVal[i + 1]) {
218
- result -= inputsVal[i];
219
- } else {
220
- result += inputsVal[i];
221
- }
222
223
224
- return result;
225
-};
226
-```
227
228
-## **Solution 2**
+## **Solution**
229
230
```js
231
var romanToInt = (s) => {
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments