6 kyu
Roman Numerals Decoder
15,758 of 50,930jhoffner
Description:
Create a function that takes a Roman numeral as its argument and returns its value as a numeric decimal integer. You don't need to validate the form of the Roman numeral.
Modern Roman numerals are written by expressing each decimal digit of the number to be encoded separately, starting with the leftmost digit and skipping any 0s. So 1990 is rendered "MCMXC" (1000 = M, 900 = CM, 90 = XC) and 2008 is rendered "MMVIII" (2000 = MM, 8 = VIII). The Roman numeral for 1666, "MDCLXVI", uses each letter in descending order.
Example:
"MM" -> 2000
"MDCLXVI" -> 1666
"M" -> 1000
"CD" -> 400
"XC" -> 90
"XL" -> 40
"I" -> 1
Help:
Symbol Value
I 1
V 5
X 10
L 50
C 100
D 500
M 1,000
Courtesy of rosettacode.org
Algorithms
Similar Kata:
Stats:
Created | Jun 10, 2013 |
Published | Jun 10, 2013 |
Warriors Trained | 123150 |
Total Skips | 21127 |
Total Code Submissions | 225083 |
Total Times Completed | 50930 |
JavaScript Completions | 15758 |
CoffeeScript Completions | 138 |
Ruby Completions | 1817 |
Python Completions | 14307 |
Haskell Completions | 637 |
C# Completions | 4184 |
PHP Completions | 2036 |
TypeScript Completions | 2378 |
Swift Completions | 903 |
C++ Completions | 4158 |
R Completions | 206 |
Nim Completions | 48 |
Go Completions | 2246 |
Elixir Completions | 282 |
Lua Completions | 240 |
Scala Completions | 268 |
Clojure Completions | 169 |
Kotlin Completions | 913 |
F# Completions | 71 |
C Completions | 750 |
CommonLisp Completions | 39 |
Dart Completions | 313 |
Rust Completions | 274 |
Total Stars | 2040 |
% of votes with a positive feedback rating | 91% of 4957 |
Total "Very Satisfied" Votes | 4203 |
Total "Somewhat Satisfied" Votes | 658 |
Total "Not Satisfied" Votes | 96 |