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 23 characters in body
Source Link
fireflame241
  • 16.4k
  • 2
  • 31
  • 74

Jelly, 4 bytes

O^/Ọ

Try it online!

Takes input as a list of the two strings, e.g. ['abcde', '01234'].

How?

O # ord: cast to number (automatically vectorizes)
 ^/ # Reduce by XOR. XOR automatically vectorizesapplies to corresponding elements
 and pads as desired to work if the two strings are different lengths
 Ọ # chr: cast to character (vectorizes once again)

Jelly, 4 bytes

O^/Ọ

Try it online!

Takes input as a list of the two strings, e.g. ['abcde', '01234'].

How?

O # ord: cast to number (automatically vectorizes)
 ^/ # Reduce by XOR. XOR automatically vectorizes
 and pads as desired to work if the two strings are different lengths
 Ọ # chr: cast to character (vectorizes once again)

Jelly, 4 bytes

O^/Ọ

Try it online!

Takes input as a list of the two strings, e.g. ['abcde', '01234'].

How?

O # ord: cast to number (automatically vectorizes)
 ^/ # Reduce by XOR. XOR automatically applies to corresponding elements
 and pads as desired to work if the two strings are different lengths
 Ọ # chr: cast to character (vectorizes once again)
Source Link
fireflame241
  • 16.4k
  • 2
  • 31
  • 74

Jelly, 4 bytes

O^/Ọ

Try it online!

Takes input as a list of the two strings, e.g. ['abcde', '01234'].

How?

O # ord: cast to number (automatically vectorizes)
 ^/ # Reduce by XOR. XOR automatically vectorizes
 and pads as desired to work if the two strings are different lengths
 Ọ # chr: cast to character (vectorizes once again)

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