g1301_1400.s1316_distinct_echo_substrings.readme.md Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leetcode-in-java Show documentation
Show all versions of leetcode-in-java Show documentation
Java-based LeetCode algorithm problem solutions, regularly updated
The newest version!
1316\. Distinct Echo Substrings
Hard
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).
**Example 1:**
**Input:** text = "abcabcabc"
**Output:** 3
**Explanation:** The 3 substrings are "abcabc", "bcabca" and "cabcab".
**Example 2:**
**Input:** text = "leetcodeleetcode"
**Output:** 2
**Explanation:** The 2 substrings are "ee" and "leetcodeleetcode".
**Constraints:**
* `1 <= text.length <= 2000`
* `text` has only lowercase English letters.
© 2015 - 2024 Weber Informatics LLC | Privacy Policy