Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Revisions

2 of 2
added 16 characters in body
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394

MathGolf, (削除) 17 (削除ここまで) 16 bytes

@♠+àm╞y\£à£/åç(§

-1 byte implicitly thanks to @CommandMaster, applying the same change as in my 05AB1E answer

I/O as a list of characters.

Try it online.
Minor note: the spaces in the input-lists are replaced with _, because there is a bug in MathGolf when reading a list that contains spaces (it reads them as ", " instead of " ")..

Explanation:

@ # Reverse triple swap, so the stack now contains two encoder lists and
 # the integer-list
 ♠+ # Add 256 to each integer
 à # Convert all integers in the list to binary-strings
 m╞ # Remove the leading "1" from each
 y # Join it to a single string
 \ # Swap so an encoder-list is at the top
 £ # Pop and push its length
 à # Convert it to a binary string
 £ # Pop and push its length again
 / # Split the earlier string into parts of that size
 å # Convert each from a binary-string back to an integer
 ç # Remove all 0s with a falsey filter
 ( # Decrease each to make the 1-based indices 0-based
 § # Index it into the remaining encode-list
 # (after which the entire stack is output implicitly as result)
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394

AltStyle によって変換されたページ (->オリジナル) /