Palindrome Partitioning IV

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 a palindrome if it is the same string when reversed.

Example 1
Inputs = "abcbdd"
Outputtrue
"abcbdd" can be split as "a" + "bcb" + "dd", and all three substrings are palindromes.
Example 2
Inputs = "bcbddxy"
Outputfalse
The string s cannot be split into 3 palindromes.

Constraints

  • 3 <= s.length <= 2000
  • s consists only of lowercase English letters.

Asked at 1 companies

</>

Your Solution

(Ctrl/Cmd + Enter)

Switching Language

Loading template...

Loading...

Sign in to save your progress

AI code evaluation

Get a correctness verdict, missed edge cases, and complexity analysis of your solution.

Sign in to evaluate