Skip to main content
added 495 characters in body
Source Link
Value Ink
  • 12.6k
  • 1
  • 17
  • 42

Ruby -p, 6868 57 bytes

-11 bytes by shamelessly stealing the method used by xnor's Python solution.

l=1
gsub(/./){l=l<<7|$&.ord}
$_=?1+(l^l/2).to_s(2)[2..-1]

Try it online!

Original solution:

gsub(/./){'%07b'%$&.ord}
l=p
gsub(/./){b=$&.ord-48;r=l ?l^b:1;l=b;r}

Try it online!

Ruby -p, 68 bytes

gsub(/./){'%07b'%$&.ord}
l=p
gsub(/./){b=$&.ord-48;r=l ?l^b:1;l=b;r}

Try it online!

Ruby -p, 68 57 bytes

-11 bytes by shamelessly stealing the method used by xnor's Python solution.

l=1
gsub(/./){l=l<<7|$&.ord}
$_=?1+(l^l/2).to_s(2)[2..-1]

Try it online!

Original solution:

gsub(/./){'%07b'%$&.ord}
l=p
gsub(/./){b=$&.ord-48;r=l ?l^b:1;l=b;r}

Try it online!

Source Link
Value Ink
  • 12.6k
  • 1
  • 17
  • 42

Ruby -p, 68 bytes

gsub(/./){'%07b'%$&.ord}
l=p
gsub(/./){b=$&.ord-48;r=l ?l^b:1;l=b;r}

Try it online!