JavaScript Algorithms: Roman to Integer (LeetCode)

Description

Symbol       Value
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
Input: "III"
Output: 3
Input: "IV"
Output: 4
Input: "IX"
Output: 9
Input: "LVIII"
Output: 58
Explanation: L = 50, V= 5, III = 3.
Input: "MCMXCIV"
Output: 1994
Explanation: M = 1000, CM = 900, XC = 90 and IV = 4.

Solution

The problem with IX, IV, XC …

Software Engineer | Frontend Developer | React Developer | JavaScript Developer https://anatolii.tech/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store