Solution to gamma2011 (Count-Palindromic-Slices) by codility

5 Feb


Question Name: CountPalindromicSlices

This task is based on the longest palindromic substring question, which has a good solution naming Manacher’s algorithm. Some explanation about the algorithm could be found here (English) and here (Chinese).

2 Replies to “Solution to gamma2011 (Count-Palindromic-Slices) by codility

  1. Hey Sheng ,
    I was really stuck with this one , however your mention of Manacher’s algorithm showed me the light and I thank you for that . My solution is slightly different than yours. I count the palindrome slices when palindrome length of index is calculated.
    Here i my code . I am not sure how to use your tags so I am pasting the result URL.

    • I experienced the same stuck, until I noticed Manacher’s algorithm. That is why I posted all my solution online, so that you do not need to stuck at the same point and nowhere to find the right direction.
      To post code, please read the “Guideline for Comments” in the right column. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

Please put your code into a <pre>YOUR CODE</pre> section. Thanks and Happy Coding!