Trying to solve Hackerrank Palindromic Borders (Algorithms > Strings). 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. 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.