We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
How do you address timeouts? Getting timeouts on 10 out of 24 test cases. I used a suffix array to generate all possible substrings then checked for proper border palindromes from them. My code is at http://ideone.com/5ca8Af. I also have a version that doesn't use a suffix array but slower at http://ideone.com/PUGTSX. And here's another version using a linear time suffix tree: http://ideone.com/vSBope. And here's another version that finds all the palindromes before looping through the suffix array to go through all the substrings to check for palindromic proper borders http://ideone.com/ZkiWAD.
Palindromic Border
You are viewing a single comment's thread. Return to all comments →
How do you address timeouts? Getting timeouts on 10 out of 24 test cases. I used a suffix array to generate all possible substrings then checked for proper border palindromes from them. My code is at http://ideone.com/5ca8Af. I also have a version that doesn't use a suffix array but slower at http://ideone.com/PUGTSX. And here's another version using a linear time suffix tree: http://ideone.com/vSBope. And here's another version that finds all the palindromes before looping through the suffix array to go through all the substrings to check for palindromic proper borders http://ideone.com/ZkiWAD.