Back to DSA
Palindrome Partitioning II
hardGiven a string, find the fewest number of cuts required to partition it so that every resulting piece reads the same forwards and backwards.
Examples
Example 1:
Input:
s = "abcba"Output:
0Explanation: The entire string is already a palindrome, so no cuts are needed.
Example 2:
Input:
s = "abcdef"Output:
5Explanation: Each character must be its own partition, requiring 5 cuts.
Hints
1234567