647. Palindromic Substrings Medium
1/**
2 * [647] Palindromic Substrings
3 *
4 * Given a string s, return the number of palindromic substrings in it.
5 * A string is a palindrome when it reads the same backward as forward.
6 * A substring is a contiguous sequence of characters within the string.
7 *
8 * Example 1:
9 *
10 * Input: s = "abc"
11 * Output: 3
12 * Explanation: Three palindromic strings: "a", "b", "c".
13 *
14 * Example 2:
15 *
16 * Input: s = "aaa"
17 * Output: 6
18 * Explanation: Six palindromic strings: "a", "a", "a", "aa", "aa", "aaa".
19 *
20 *
21 * Constraints:
22 *
23 * 1 <= s.length <= 1000
24 * s consists of lowercase English letters.
25 *
26 */
27pub struct Solution {}
28
29// problem: https://leetcode.com/problems/palindromic-substrings/
30// discuss: https://leetcode.com/problems/palindromic-substrings/discuss/?currentPage=1&orderBy=most_votes&query=
31
32// submission codes start here
33
34impl Solution {
35 pub fn count_substrings(s: String) -> i32 {
36 0
37 }
38}
39
40// submission codes end
41
42#[cfg(test)]
43mod tests {
44 use super::*;
45
46 #[test]
47 fn test_647() {
48 }
49}
50
Back
© 2025 bowen.ge All Rights Reserved.