Skip to content

Practice Maximum Number of Non-overlapping Palindrome Substrings

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Hard#2472
LeetCode Problem

Maximum Number of Non-overlapping Palindrome Substrings

Problem Statement

Select as many nonoverlapping contiguous substrings of s as possible, with each selected substring a palindrome of length at least k. Return the maximum number selected.

Source: Maximum Number of Non-overlapping Palindrome Substrings on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
s = "abaccdbbd", k = 3
Output
2

# Example 2

Input
s = "adbcda", k = 2
Output
0

Constraints

1 <= k <= s.length <= 2000
s consists of lowercase English letters.

Related LeetCode Problems

Practice more problems similar to Maximum Number of Non-overlapping Palindrome Substrings.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.