391
(page 2) 10 comments
sorted by: hot top controversial new old
[-] eah@programming.dev 8 points 1 day ago* (last edited 13 hours ago)

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

[-] ray@sh.itjust.works 2 points 1 day ago
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();
}
load more comments (1 replies)
load more comments (4 replies)
[-] SpaceNoodle@lemmy.world 7 points 1 day ago
load more comments (3 replies)
[-] Olap@lemmy.world 6 points 1 day ago

until(original=new) { run convertOriginal }

[-] fckreddit@lemmy.ml 5 points 1 day ago

I just wrote something similar for decoding binary asm instructions.

[-] Valmond@lemmy.world 3 points 1 day ago

If you have the time it's a good solution!

[-] panda_abyss@lemmy.ca 5 points 1 day ago

Should do a regex find all then iterate over each chunk recursively until unchanged.

load more comments (2 replies)
load more comments
view more: ‹ prev next ›
this post was submitted on 11 Oct 2025
391 points (100.0% liked)

Programmer Humor

26827 readers
1659 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