Zepruv › Coding problems

Palindrome Partitioning IV

Hard · String, Dynamic Programming

Given a string s, return true if it is possible to split the string s into three non-empty palindromic substrings. Otherwise, return false.​​​​​
A string is said to be palindrome if it the same string when reversed.

Example 1

Input: s = "abcbdd"
Output: true

"abcbdd" = "a" + "bcb" + "dd", and all three substrings are palindromes.

Example 2

Input: s = "bcbddxy"
Output: false

s cannot be split into 3 palindromes.

Constraints

Starter code (python)

class Solution(object):
    def checkPartitioning(self, s):
        """
        :type s: str
        :rtype: bool
        """
        

Related problems

Previous: Change Minimum Characters to Satisfy One of Three Conditions · Next: Can You Eat Your Favorite Candy on Your Favorite Day? · All problems

Zepruv is a technical interview practice platform. Read any problem for free; sign in to run your code, submit and keep your progress.