Skip to content

Instantly share code, notes, and snippets.

@danny-andrews
Created July 20, 2021 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danny-andrews/c393a579d58a2355fb50aea4901da623 to your computer and use it in GitHub Desktop.
Save danny-andrews/c393a579d58a2355fb50aea4901da623 to your computer and use it in GitHub Desktop.
Longest Palindrome
/**
* Implement a function that finds the longest palindrome in a given string.
* For example, in the string "My dad is a racecar athlete", the longest
* palindrome is "a racecar a". Count whitespaces as valid characters. Other
* palindromes in the above string include "dad", "ete", " dad " (including
* whitespace on each side of dad).
*/
function longestPalindrome(string) {}
console.log(longestPalindrome("My dad is a racecar athlete") === "a racecar a");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment