[Swift] LeetCode1316 different cycle substring |. Distinct Echo Substrings

★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
➤ micro-channel public number: Shan Wing Chi ( let_us_code)
➤ bloggers domain: https://www.zengqiang.org
➤GitHub address: https://github.com/strengthen/LeetCode
➤ original address: https://www.cnblogs.com/strengthen/p/12185573 .html
➤ If the address is not a link blog Park Yong Shan Chi, it may be crawling author of the article.
➤ text has been modified update! Click strongly recommended that the original address read! Support authors! Support the original!
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★

Return the number of distinct non-empty substrings of text that can be written as the concatenation of some string with itself.

 

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.


You give a string text, please return to satisfy the following condition number of different non-empty strings:

It can be written in the form of a string is connected with itself.
For example, abcabc abc and is formed by the connection itself.

 

Example 1:

Input: text = "abcabcabc"
Output: 3
Explanation: 3 substrings are "abcabc", "bcabca" and "cabcab".
Example 2:

Input: text = "leetcodeleetcode"
Output: 2
Explanation: 2 sub-string "ee" and "leetcodeleetcode".
 

prompt:

. 1 <= text.length <= 2000
text contains only lowercase letters.

Guess you like

Origin www.cnblogs.com/strengthen/p/12185573.html