@all please discuss your approaches for the DECORATE question.
I’ve gone through the Manacher’s algorithm to find the number of palindromes.But after that how to solve the combinatorial problem?
What I could deduce while trying to solve the question was to find the number of ways for-
seating n distinct objects around a round table with k seats(where clockwise and anti-clockwise arrangements are same) where each object can have any number of copies.here n is the number of distinct palindromes in the string T and k is the number of bouquets.I got hold of this link after the contest was over http://en.wikipedia.org/wiki/Necklace_(combinatorics)
But how do we arrive on such formulas.Or is there a simpler approach to this question?
My knowledge of basic combinatorics could only tell me that if there are n distinct objects around a round table with n seats and clockwise and anti-clockwise are same then number of ways is (n-1)!/2.
I went through the codes of people who passed but couldn’t understand the combinatorial part.