java.lang.Object
g0101_0200.s0132_palindrome_partitioning_ii.Solution

public class Solution extends Object
132 - Palindrome Partitioning II.<p>Hard</p> <p>Given a string <code>s</code>, partition <code>s</code> such that every substring of the partition is a palindrome.</p> <p>Return <em>the minimum cuts needed</em> for a palindrome partitioning of <code>s</code>.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> s = &ldquo;aab&rdquo;</p> <p><strong>Output:</strong> 1</p> <p><strong>Explanation:</strong> The palindrome partitioning [&ldquo;aa&rdquo;,&ldquo;b&rdquo;] could be produced using 1 cut.</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> s = &ldquo;a&rdquo;</p> <p><strong>Output:</strong> 0</p> <p><strong>Example 3:</strong></p> <p><strong>Input:</strong> s = &ldquo;ab&rdquo;</p> <p><strong>Output:</strong> 1</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= s.length <= 2000</code></li> <li><code>s</code> consists of lower-case English letters only.</li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • minCut

      public int minCut(String s)