2023-12-09 18:42:21 +08:00
< p > Given a string < code > s< / code > , partition < code > s< / code > such that every < span data-keyword = "substring-nonempty" > substring< / span > of the partition is a < span data-keyword = "palindrome-string" > palindrome< / span > .< / p >
2022-03-27 20:56:26 +08:00
2023-12-09 18:42:21 +08:00
< p > Return < em > the < strong > minimum< / strong > cuts needed for a palindrome partitioning of< / em > < code > s< / code > .< / p >
2022-03-27 20:56:26 +08:00
< p > < / p >
2023-12-09 18:42:21 +08:00
< p > < strong class = "example" > Example 1:< / strong > < / p >
2022-03-27 20:56:26 +08:00
< pre >
< strong > Input:< / strong > s = " aab"
< strong > Output:< / strong > 1
< strong > Explanation:< / strong > The palindrome partitioning [" aa" ," b" ] could be produced using 1 cut.
< / pre >
2023-12-09 18:42:21 +08:00
< p > < strong class = "example" > Example 2:< / strong > < / p >
2022-03-27 20:56:26 +08:00
< pre >
< strong > Input:< / strong > s = " a"
< strong > Output:< / strong > 0
< / pre >
2023-12-09 18:42:21 +08:00
< p > < strong class = "example" > Example 3:< / strong > < / p >
2022-03-27 20:56:26 +08:00
< pre >
< strong > Input:< / strong > s = " ab"
< strong > Output:< / strong > 1
< / pre >
< p > < / p >
< p > < strong > Constraints:< / strong > < / p >
< ul >
< li > < code > 1 < = s.length < = 2000< / code > < / li >
< li > < code > s< / code > consists of lowercase English letters only.< / li >
< / ul >