Skip to main content
deleted 534 characters in body
Source Link
ovs
  • 60.6k
  • 3
  • 47
  • 161

Haskell, 8080 66 bytes

map(!"0123456789ihgfedcbaj""1a2b3c4d5e6f7g8h9i0j")
e!""=e
e!(xa:b:y)|e==x=last y|e==last y=x|1<2=e|e==a=b|e==b=a|1<2=e!init y

Try it online!


Haskell -XViewPatterns, 80 bytes

map(!"0123456789ihgfedcbaj")
e!""=e
e!(x:y@(last->z))|e==x=z|e==z=x|1<2=e!init y_=e

Try it online!Try it online!

Haskell, 80 bytes

map(!"0123456789ihgfedcbaj")
e!""=e
e!(x:y)|e==x=last y|e==last y=x|1<2=e!init y

Try it online!


Haskell -XViewPatterns, 80 bytes

map(!"0123456789ihgfedcbaj")
e!""=e
e!(x:y@(last->z))|e==x=z|e==z=x|1<2=e!init y

Try it online!

Haskell, 80 66 bytes

map(!"1a2b3c4d5e6f7g8h9i0j")
e!(a:b:y)|e==a=b|e==b=a|1<2=e!y
e!_=e

Try it online!

Source Link
ovs
  • 60.6k
  • 3
  • 47
  • 161

Haskell, 80 bytes

map(!"0123456789ihgfedcbaj")
e!""=e
e!(x:y)|e==x=last y|e==last y=x|1<2=e!init y

Try it online!


Haskell -XViewPatterns, 80 bytes

map(!"0123456789ihgfedcbaj")
e!""=e
e!(x:y@(last->z))|e==x=z|e==z=x|1<2=e!init y

Try it online!