441
you are viewing a single comment's thread
view the rest of the comments
[-] eah@programming.dev 8 points 3 days ago* (last edited 2 days ago)

It's got some code duplication. Who can code ~~gulf~~ golf this?

[-] TheLazyNerd@europe.pub 2 points 2 days ago* (last edited 2 days 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();}

load more comments (5 replies)
this post was submitted on 11 Oct 2025
441 points (99.8% liked)

Programmer Humor

26865 readers
637 users here now

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.

Rules

founded 2 years ago
MODERATORS