1147. Longest Chunked Palindrome Decomposition
https://leetcode.com/problems/longest-chunked-palindrome-decomposition
Description
You are given a string text
. You should split it to k substrings (subtext1, subtext2, ..., subtextk)
such that:
subtexti
is a non-empty string.The concatenation of all the substrings is equal to
text
(i.e.,subtext1 + subtext2 + ... + subtextk == text
).subtexti == subtextk - i + 1
for all valid values ofi
(i.e.,1 <= i <= k
).
Return the largest possible value of k
.
Example 1:
Example 2:
Example 3:
Example 4:
Constraints:
1 <= text.length <= 1000
text
consists only of lowercase English characters.
ac
Last updated