Created
          March 24, 2012 21:39 
        
      - 
      
- 
        Save joshbuddy/2188292 to your computer and use it in GitHub Desktop. 
  
    
      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
    
  
  
    
  | For an arbitrary string, detect the largest palindrome* present within it. | |
| * a sequence of characters the same forwards and backwards at least 3 characters long. | |
| For instance in "abbabcdedc", the longest palindrome would be "cdedc". | |
| Answers? | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Here's something in Haskell. I tried to decompose the problem into 1. make substrings, 2. filter out non palindromes, then 3. find the longest string.
substringstime complexity grows like a Trianglular number. I thinkpalindromeandlongestare both O(n).Usage:
longest (palindromes "abbabcdedc")