1446. Consecutive Characters Easy

@problem@discussion
#String



1/**
2 * [1446] Consecutive Characters
3 *
4 * The power of the string is the maximum length of a non-empty substring that contains only one unique character.
5 * Given a string s, return the power of s.
6 *  
7 * Example 1:
8 * 
9 * Input: s = "leetcode"
10 * Output: 2
11 * Explanation: The substring "ee" is of length 2 with the character 'e' only.
12 * 
13 * Example 2:
14 * 
15 * Input: s = "abbcccddddeeeeedcba"
16 * Output: 5
17 * Explanation: The substring "eeeee" is of length 5 with the character 'e' only.
18 * 
19 *  
20 * Constraints:
21 * 
22 * 	1 <= s.length <= 500
23 * 	s consists of only lowercase English letters.
24 * 
25 */
26pub struct Solution {}
27
28// problem: https://leetcode.com/problems/consecutive-characters/
29// discuss: https://leetcode.com/problems/consecutive-characters/discuss/?currentPage=1&orderBy=most_votes&query=
30
31// submission codes start here
32
33impl Solution {
34    pub fn max_power(s: String) -> i32 {
35        0
36    }
37}
38
39// submission codes end
40
41#[cfg(test)]
42mod tests {
43    use super::*;
44
45    #[test]
46    fn test_1446() {
47    }
48}
49


Back
© 2025 bowen.ge All Rights Reserved.