Skip to main content
Post Undeleted by tsh
added 5 characters in body
Source Link
tsh
  • 35.6k
  • 2
  • 34
  • 129

Python 3, 5556 bytes

def f(a,d):
 try:x,y,*a[*z=a;a[:]=*a]=*z,*d[a[0]];f*d[x];f(a,d)
 except:0

Try it online!Try it online!

This function take input as a list of chars, and a dict of char to list of chars. And it returns by modify a in-place.


And if terminating the function by an exception is allowed, it could be even shorter:

Python 3, 3940 bytes

def f(a,d):x,y,*a[*z=a;a[:]=*a]=*z,*d[a[0]];f*d[x];f(a,d)

Try it online!Try it online!

Python 3, 55 bytes

def f(a,d):
 try:x,y,*a[:]=*a,*d[a[0]];f(a,d)
 except:0

Try it online!

This function take input as a list of chars, and a dict of char to list of chars. And it returns by modify a in-place.


And if terminating the function by an exception is allowed, it could be even shorter:

Python 3, 39 bytes

def f(a,d):x,y,*a[:]=*a,*d[a[0]];f(a,d)

Try it online!

Python 3, 56 bytes

def f(a,d):
 try:x,y,*z=a;a[:]=*z,*d[x];f(a,d)
 except:0

Try it online!

This function take input as a list of chars, and a dict of char to list of chars. And it returns by modify a in-place.


And if terminating the function by an exception is allowed, it could be even shorter:

Python 3, 40 bytes

def f(a,d):x,y,*z=a;a[:]=*z,*d[x];f(a,d)

Try it online!

Post Deleted by tsh
Source Link
tsh
  • 35.6k
  • 2
  • 34
  • 129

Python 3, 55 bytes

def f(a,d):
 try:x,y,*a[:]=*a,*d[a[0]];f(a,d)
 except:0

Try it online!

This function take input as a list of chars, and a dict of char to list of chars. And it returns by modify a in-place.


And if terminating the function by an exception is allowed, it could be even shorter:

Python 3, 39 bytes

def f(a,d):x,y,*a[:]=*a,*d[a[0]];f(a,d)

Try it online!