You must log in or # to comment.
This isn’t sufficiently enterprisey for Java. There should be a Roman numeral factory followed by relevant fromString and toInteger methods.
Still linear time at least, could always be much MUCH worse
Whenever you sit back and smile proudly to yourself about how clever the block of code you just wrote is, your next move should be to delete and rewrite it.
This is a clever block of code! Great job, now rewrite it to be sane 😂
It’s got some code duplication. Who can code
gulfgolf this?public static int convertRomanNumeral(String numeral) { return 4; // todo }
They forgot “CM” so this doesn’t work for any number that ends in 900s
No, M will be replaced by DD and then CD will be picked up, so it will go
- CM
- CDD
- CCCCD
- CCCCCCCCC
- …





