Skip to main content
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

Ruby, 29 bytes

->s,n{s[0]+s[n+1...~n]+s[-1]}

Very straightforward.

~ trick stolen from Sp's answerSp's answer, which saves a byte over s[n+1..-2-n]. (It works because ~n is -1-n in two's-complement, and then ... is an exclusive range.)

Ruby, 29 bytes

->s,n{s[0]+s[n+1...~n]+s[-1]}

Very straightforward.

~ trick stolen from Sp's answer, which saves a byte over s[n+1..-2-n]. (It works because ~n is -1-n in two's-complement, and then ... is an exclusive range.)

Ruby, 29 bytes

->s,n{s[0]+s[n+1...~n]+s[-1]}

Very straightforward.

~ trick stolen from Sp's answer, which saves a byte over s[n+1..-2-n]. (It works because ~n is -1-n in two's-complement, and then ... is an exclusive range.)

Source Link
Doorknob
  • 71.8k
  • 20
  • 143
  • 385

Ruby, 29 bytes

->s,n{s[0]+s[n+1...~n]+s[-1]}

Very straightforward.

~ trick stolen from Sp's answer, which saves a byte over s[n+1..-2-n]. (It works because ~n is -1-n in two's-complement, and then ... is an exclusive range.)