dynamic_programming.palindrome_partitioning

Given a string s, partition s such that every substring of the partition is a palindrome. Find the minimum cuts needed for a palindrome partitioning of s.

Time Complexity: O(n^2) Space Complexity: O(n^2) For other explanations refer to: https://www.youtube.com/watch?v=_H8V5hJUGd0

Attributes

s

Functions

find_minimum_partitions(→ int)

Returns the minimum cuts needed for a palindrome partitioning of string

Module Contents

dynamic_programming.palindrome_partitioning.find_minimum_partitions(string: str) int

Returns the minimum cuts needed for a palindrome partitioning of string

>>> find_minimum_partitions("aab")
1
>>> find_minimum_partitions("aaa")
0
>>> find_minimum_partitions("ababbbabbababa")
3
dynamic_programming.palindrome_partitioning.s