随笔分类 - 回文树
摘要:题目 题意:判断一个字符串是否可以由三个回文串组成 题解:利用强大的回文树,计算出以每个字符为结尾的回文串,然后从字符串的最后一个字符开始,递归判断。 struct Tree { int next[4005][30]; int fail[4005]; int cnt[4005]; int num[4
阅读全文
摘要:"https://leetcode.com/problems/shortest palindrome/" 好题目啊! 题目: Given a string s, you are allowed to convert it to a palindrome by adding characters in
阅读全文