Created
July 20, 2021 14:35
-
-
Save danny-andrews/c393a579d58a2355fb50aea4901da623 to your computer and use it in GitHub Desktop.
Longest Palindrome
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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