Skip to content

Instantly share code, notes, and snippets.

@tttardigrado
Last active January 27, 2023 12:22
Show Gist options
  • Save tttardigrado/f96feea94f538552f9e1182554b02637 to your computer and use it in GitHub Desktop.
Save tttardigrado/f96feea94f538552f9e1182554b02637 to your computer and use it in GitHub Desktop.

Shortest code to determine if a string is a palindrome

Challenge link

Vyxal, 10 bytes

ɽẊ':₌ʀ±∨;Ḃ⁼

How it works

ɽ        # Since casing doesn't matter, map the string to lower case
':₌ʀ±∨;  # Filter for alpha-numerical characters -> filter (isAlpha || isNum)
Ḃ        # Bifurcate     a -> a, rev(a)
⁼        # Check if they are equal (i.e. the string is a palindrome) 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment