Created
October 22, 2021 14:09
-
-
Save oreillyross/7be778c0619499d2617e0315104c784a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {string} s | |
* @return {number} | |
*/ | |
var romanToInt = function(s) { | |
let sum = 0; | |
let remainingS = s; | |
const symbols = { | |
'IV':4, | |
'IX':9, | |
'XL':40, | |
'XC':90, | |
'CD':400, | |
'CM':900, | |
'I': 1, | |
'V': 5, | |
'X': 10, | |
'L': 50, | |
'C': 100, | |
'D': 500, | |
'M': 1000, | |
}; | |
Object.keys(symbols).map((sym) => { | |
while () | |
}) | |
return sum; | |
}; | |
console.log(romanToInt('IV')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment