Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
My initial instinct was to implement something similar to yours but decided the code was too complex and doing too many unnecessary calculations. So I switched it to a simple substitution and capped my table to meet the requirements of the kata (actually I over-engineered it by one entry). This doesn't make mine right and yours wrong, we're just solving it around different priorities.
There is a limit in the input range (or should be) for that to be true.
What do you do if you have something like
MMMMMMMMMMMMMMMMMMMMMMMXI as roman number?
Your system breaks, or you have to hardcode an infinite amount of numbers
This solution doesn't hardcode any more data than is absolutely necessary (M=1000,D=500, etc) and is hence infinitely extensible. I also think it doesn't do any unnecessary calculations?
https://www.codewars.com/kata/reviews/5b5768fbfb9a0dbfc3001e0e/groups/5c7d22c06e54c8000115c1c8
I'd probably do a couple of things differently if this was production code, but I would keep the symbols in an encoding table. Why calculate the same values over and over again?
Clever, but definitely not best practices, as you hardcoded literally everything