Skip to content

Practice Distinct Echo 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#1316
LeetCode Problem

Distinct Echo Substrings

Problem Statement

Return the number of distinct non-empty substrings of text that can be written as the concatenation of some string with itself (i.e. it can be written as a + a where a is some string).

Source: Distinct Echo Substrings on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
text = "abcabcabc"
Output
3

# Example 2

Input
text = "leetcodeleetcode"
Output
2

Constraints

1 <= text.length <= 2000
text has only lowercase English letters.

Related LeetCode Problems

Practice more problems similar to Distinct Echo Substrings.

Review your practice with PhantomCodeAI

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