391
Who cares about time complexity
(lemmy.world)
It's got some code duplication. Who can code ~~gulf~~ golf this?
public static int convertRomanNumeral(String numeral)
{
numeral = numeral.replace("M", "DD")
.replace("CD", "CCCC")
.replace("D", "CCCCC")
.replace("C", "LL")
.replace("XL", "XXXX")
.replace("L", "XXXXX")
.replace("X", "VV")
.replace("IV", "IIII")
.replace("V", "IIIII");
return numeral.length();
}
until(original=new) { run convertOriginal }
I just wrote something similar for decoding binary asm instructions.
If you have the time it's a good solution!
Should do a regex find all then iterate over each chunk recursively until unchanged.
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.