459. Repeated Substring Pattern Easy

@problem@discussion
#String#String Matching



1/**
2 * [459] Repeated Substring Pattern
3 *
4 * Given a string s, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together.
5 *  
6 * Example 1:
7 * 
8 * Input: s = "abab"
9 * Output: true
10 * Explanation: It is the substring "ab" twice.
11 * 
12 * Example 2:
13 * 
14 * Input: s = "aba"
15 * Output: false
16 * 
17 * Example 3:
18 * 
19 * Input: s = "abcabcabcabc"
20 * Output: true
21 * Explanation: It is the substring "abc" four times or the substring "abcabc" twice.
22 * 
23 *  
24 * Constraints:
25 * 
26 * 	1 <= s.length <= 10^4
27 * 	s consists of lowercase English letters.
28 * 
29 */
30pub struct Solution {}
31
32// problem: https://leetcode.com/problems/repeated-substring-pattern/
33// discuss: https://leetcode.com/problems/repeated-substring-pattern/discuss/?currentPage=1&orderBy=most_votes&query=
34
35// submission codes start here
36
37impl Solution {
38    pub fn repeated_substring_pattern(s: String) -> bool {
39        false
40    }
41}
42
43// submission codes end
44
45#[cfg(test)]
46mod tests {
47    use super::*;
48
49    #[test]
50    fn test_459() {
51    }
52}
53


Back
© 2025 bowen.ge All Rights Reserved.