1316. Distinct Echo Substrings Hard

@problem@discussion
#String#Trie#Rolling Hash#Hash Function



1/**
2 * [1316] Distinct Echo Substrings
3 *
4 * 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).
5 *  
6 * Example 1:
7 * 
8 * Input: text = "abcabcabc"
9 * Output: 3
10 * Explanation: The 3 substrings are "abcabc", "bcabca" and "cabcab".
11 * 
12 * Example 2:
13 * 
14 * Input: text = "leetcodeleetcode"
15 * Output: 2
16 * Explanation: The 2 substrings are "ee" and "leetcodeleetcode".
17 * 
18 *  
19 * Constraints:
20 * 
21 * 	1 <= text.length <= 2000
22 * 	text has only lowercase English letters.
23 * 
24 */
25pub struct Solution {}
26
27// problem: https://leetcode.com/problems/distinct-echo-substrings/
28// discuss: https://leetcode.com/problems/distinct-echo-substrings/discuss/?currentPage=1&orderBy=most_votes&query=
29
30// submission codes start here
31
32impl Solution {
33    pub fn distinct_echo_substrings(text: String) -> i32 {
34        0
35    }
36}
37
38// submission codes end
39
40#[cfg(test)]
41mod tests {
42    use super::*;
43
44    #[test]
45    fn test_1316() {
46    }
47}
48


Back
© 2025 bowen.ge All Rights Reserved.