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 Answer

added 16 characters in body
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394

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

@à◄▐0═╡y\£à£@♠+à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. 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
 à # Convert all integers in the list to binary-strings
 ♠+ ◄▐ # AppendAdd 10000000256 to thiseach listinteger
 à 0═ # PadConvert all strings to an equalintegers lengthin bythe paddinglist leadingto 0sbinary-strings
 m╞  # Remove the finalleading item"1" (thefrom 10000000)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)

MathGolf, 17 bytes

@à◄▐0═╡y\£à£/åç(§

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
 à # Convert all integers in the list to binary-strings
 ◄▐ # Append 10000000 to this list
 0═ # Pad all strings to an equal length by padding leading 0s
  # Remove the final item (the 10000000)
 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)

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)
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394

MathGolf, 17 bytes

@à◄▐0═╡y\£à£/åç(§

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
 à # Convert all integers in the list to binary-strings
 ◄▐ # Append 10000000 to this list
 0═ # Pad all strings to an equal length by padding leading 0s
 ╡ # Remove the final item (the 10000000)
 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)

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