• TheLazyNerd@europe.pub
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    5 hours ago

    I’m not too good with java, but it should be something like this:

    public static int convertRomanNumeral(string n){Map.of("M","DD","CD","CCCC","D","CCCCC","C","LL","XL","XXXX","L","XXXXX","X","VV","IV","IIII","V","IIIII");.forEach((k,v)->{n=n.replace(k,v);});return n.length();}