Roman Numerals Mini Challenge
Completed Aug. 6, 2011
This challenge is all about Roman Numerals! While chatting about software interviews on IRC, someone recounted being asked to convert between roman and arabic up on the whiteboard. Let's see how everyone else does.
Write two functions:
A method that will take a Roman numeral string as input and output an integer representing the value of that Roman numeral.
Examples: "X" -> 10 "XXIX" -> 29 "XXXV" -> 35
A method that will take an integer <= 3999 as input and output that number represented as a Roman numeral. Examples:
Examples: 10 -> "X" 13 -> "XIII" 52 -> "LII"
Roman Numerals on Wikipedia
We'll run the challenge until 3AM Pacific time on Saturday, so get your entries in. Points for style and creativity! Thanks to quanticle for the submission!