6 kyu

Roman Numerals Encoder

16,026 of 56,641jhoffner

Description:

Create a function taking a positive integer between 1 and 3999 (both included) as its parameter and returning a string containing the Roman Numeral representation of that integer.

Modern Roman numerals are written by expressing each digit separately starting with the leftmost digit and skipping any digit with a value of zero. There cannot be more than 3 identical symbols in a row.

In Roman numerals:

  • 1990 is rendered: 1000=M + 900=CM + 90=XC; resulting in MCMXC.
  • 2008 is written as 2000=MM, 8=VIII; or MMVIII.
  • 1666 uses each Roman symbol in descending order: MDCLXVI.

Example:

   1 -->       "I"
1000 -->       "M"
1666 --> "MDCLXVI"

Help:

Symbol    Value
I          1
V          5
X          10
L          50
C          100
D          500
M          1,000

More about roman numerals

Algorithms

Stats:

CreatedJun 10, 2013
PublishedJun 10, 2013
Warriors Trained167577
Total Skips30462
Total Code Submissions216151
Total Times Completed56641
JavaScript Completions16026
CoffeeScript Completions134
Ruby Completions1939
Python Completions15387
Haskell Completions604
Java Completions7111
TypeScript Completions1761
C++ Completions3889
PHP Completions1917
C# Completions3755
Swift Completions859
Elixir Completions226
Rust Completions974
R Completions174
Solidity Completions208
C Completions1310
Nim Completions32
Lua Completions174
Scala Completions244
Kotlin Completions704
Julia Completions40
Clojure Completions34
COBOL Completions9
Go Completions597
F# Completions24
Total Stars3346
% of votes with a positive feedback rating90% of 5424
Total "Very Satisfied" Votes4508
Total "Somewhat Satisfied" Votes795
Total "Not Satisfied" Votes121
Ad
Contributors
  • jhoffner Avatar
  • dnolan Avatar
  • seidchr Avatar
  • cvk77 Avatar
  • Unnamed Avatar
  • bstenzel Avatar
  • JDeBolt Avatar
  • brunolm Avatar
  • ver0man Avatar
  • donaldsebleung Avatar
  • Quickz Avatar
  • Chrono79 Avatar
  • imjasonmiller Avatar
  • dorialan Avatar
  • user4912975 Avatar
  • Ze-Marcos Avatar
  • Blind4Basics Avatar
  • Voile Avatar
  • mentalplex Avatar
  • rsa Avatar
  • Udiknedormin Avatar
  • metagn Avatar
  • FArekkusu Avatar
  • konkath Avatar
  • hobovsky Avatar
  • xavierguihot Avatar
  • stellartux Avatar
  • trashy_incel Avatar
  • ejini战神 Avatar
  • slnt_opp Avatar
  • BrainHorse Avatar
  • akar-0 Avatar
  • dfhwze Avatar
  • 4500zenja1 Avatar
  • KayleighWasTaken Avatar
Ad