Practice Longest Chunked Palindrome Decomposition
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Hard#1147
LeetCode ProblemLongest Chunked Palindrome Decomposition
Problem Statement
Split text into nonempty consecutive chunks whose concatenation is text. The first chunk must equal the last, the second must equal the second-to-last, and so on. Return the greatest possible number of chunks satisfying this symmetry.
Source: Longest Chunked Palindrome Decomposition on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
text = "ghiabcdefhelloadamhelloabcdefghi"
Output
7
# Example 2
Input
text = "merchant"
Output
1
# Example 3
Input
text = "antaprezatepzapreanta"
Output
11
Constraints
1 <= text.length <= 1000
text consists only of lowercase English characters.
Related LeetCode Problems
Practice more problems similar to Longest Chunked Palindrome Decomposition.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.