#1745
Palindrome Partitioning IV
candidate master · 1555 · lc hard +32 · verified · 45.2% accepted · 964 likes · top 28%
Description
Given a string s, return true if it can be partitioned into exactly three non-empty palindromic substrings.
Example 1:
Input: s = "abcbdd"
Output: true
Explanation: "abcbdd" = "a" + "bcb" + "dd", and all three substrings are palindromes.
Example 2:
Input: s = "bcbddxy"
Output: false
Explanation: s cannot be split into 3 palindromes.
Code
1
2
3