Skip to main content
deleted 212 characters in body
Source Link
Gábor Fekete
  • 3.5k
  • 1
  • 9
  • 19

Python 3.8 (pre-release), 6088 bytes

lambdaf=lambda a,b,s={}:[a.pop(-f(a[:1]+a[-1a,b[1:]).index(c)),{b[0]+t for ct in b[::-1]]s}|{t+b[0]for t in s}|{b[0]})if b else{a}&s

Try it online!

Accepts the string as a list of characters. Returns the reverse of the second parameter as a list of characters when truthy. Throws exception when it's falsy. Exception contains the first character that couldn't be inserted on the letterboard.Try it online!

I used the reverserewrote it using sets and recursion, empty set is falsy, builds up a set of the secondincreasing string that get appended and tried removing it's letters from either the start or the end ofprepended by the first stringnext character.

Python 3.8 (pre-release), 60 bytes

lambda a,b:[a.pop(-(a[:1]+a[-1:]).index(c))for c in b[::-1]]

Try it online!

Accepts the string as a list of characters. Returns the reverse of the second parameter as a list of characters when truthy. Throws exception when it's falsy. Exception contains the first character that couldn't be inserted on the letterboard.

I used the reverse of the second string and tried removing it's letters from either the start or the end of the first string.

Python 3.8 (pre-release), 88 bytes

f=lambda a,b,s={}:f(a,b[1:],{b[0]+t for t in s}|{t+b[0]for t in s}|{b[0]})if b else{a}&s

Try it online!

I rewrote it using sets and recursion, empty set is falsy, builds up a set of increasing string that get appended and prepended by the next character.

added 85 characters in body
Source Link
Gábor Fekete
  • 3.5k
  • 1
  • 9
  • 19

Python 3.8 (pre-release), 60 bytes

lambda a,b:[a.pop(-(a[:1]+a[-1:]).index(c))for c in b[::-1]]

Try it online!

Accepts the string as a list of characters. Returns the reverse of the second parameter as a list of characters when truthy. Throws exception when it's falsy. Exception contains the first character that couldn't be inserted on the letterboard.

I used the reverse of the second string and tried removing it's letters from either the start or the end of the first string.

Python 3.8 (pre-release), 60 bytes

lambda a,b:[a.pop(-(a[:1]+a[-1:]).index(c))for c in b[::-1]]

Try it online!

Accepts the string as a list of characters. Returns the reverse of the second parameter as a list of characters when truthy. Throws exception when it's falsy.

I used the reverse of the second string and tried removing it's letters from either the start or the end of the first string.

Python 3.8 (pre-release), 60 bytes

lambda a,b:[a.pop(-(a[:1]+a[-1:]).index(c))for c in b[::-1]]

Try it online!

Accepts the string as a list of characters. Returns the reverse of the second parameter as a list of characters when truthy. Throws exception when it's falsy. Exception contains the first character that couldn't be inserted on the letterboard.

I used the reverse of the second string and tried removing it's letters from either the start or the end of the first string.

Source Link
Gábor Fekete
  • 3.5k
  • 1
  • 9
  • 19

Python 3.8 (pre-release), 60 bytes

lambda a,b:[a.pop(-(a[:1]+a[-1:]).index(c))for c in b[::-1]]

Try it online!

Accepts the string as a list of characters. Returns the reverse of the second parameter as a list of characters when truthy. Throws exception when it's falsy.

I used the reverse of the second string and tried removing it's letters from either the start or the end of the first string.