132. Palindrome Partitioning II Hard
1/**
2 * [132] Palindrome Partitioning II
3 *
4 * Given a string s, partition s such that every substring of the partition is a palindrome.
5 * Return the minimum cuts needed for a palindrome partitioning of s.
6 *
7 * Example 1:
8 *
9 * Input: s = "aab"
10 * Output: 1
11 * Explanation: The palindrome partitioning ["aa","b"] could be produced using 1 cut.
12 *
13 * Example 2:
14 *
15 * Input: s = "a"
16 * Output: 0
17 *
18 * Example 3:
19 *
20 * Input: s = "ab"
21 * Output: 1
22 *
23 *
24 * Constraints:
25 *
26 * 1 <= s.length <= 2000
27 * s consists of lowercase English letters only.
28 *
29 */
30pub struct Solution {}
31
32// problem: https://leetcode.com/problems/palindrome-partitioning-ii/
33// discuss: https://leetcode.com/problems/palindrome-partitioning-ii/discuss/?currentPage=1&orderBy=most_votes&query=
34
35// submission codes start here
36
37impl Solution {
38 pub fn min_cut(s: String) -> i32 {
39 0
40 }
41}
42
43// submission codes end
44
45#[cfg(test)]
46mod tests {
47 use super::*;
48
49 #[test]
50 fn test_132() {
51 }
52}
53
Back
© 2025 bowen.ge All Rights Reserved.