2414. Length of the Longest Alphabetical Continuous Substring Medium

@problem@discussion
#String



1/**
2 * [2414] Length of the Longest Alphabetical Continuous Substring
3 *
4 * An alphabetical continuous string is a string consisting of consecutive letters in the alphabet. In other words, it is any substring of the string "abcdefghijklmnopqrstuvwxyz".
5 * 
6 * 	For example, "abc" is an alphabetical continuous string, while "acb" and "za" are not.
7 * 
8 * Given a string s consisting of lowercase letters only, return the length of the longest alphabetical continuous substring.
9 *  
10 * Example 1:
11 * 
12 * Input: s = "abacaba"
13 * Output: 2
14 * Explanation: There are 4 distinct continuous substrings: "a", "b", "c" and "ab".
15 * "ab" is the longest continuous substring.
16 * 
17 * Example 2:
18 * 
19 * Input: s = "abcde"
20 * Output: 5
21 * Explanation: "abcde" is the longest continuous substring.
22 * 
23 *  
24 * Constraints:
25 * 
26 * 	1 <= s.length <= 10^5
27 * 	s consists of only English lowercase letters.
28 * 
29 */
30pub struct Solution {}
31
32// problem: https://leetcode.com/problems/length-of-the-longest-alphabetical-continuous-substring/
33// discuss: https://leetcode.com/problems/length-of-the-longest-alphabetical-continuous-substring/discuss/?currentPage=1&orderBy=most_votes&query=
34
35// submission codes start here
36
37impl Solution {
38    pub fn longest_continuous_substring(s: String) -> i32 {
39        0
40    }
41}
42
43// submission codes end
44
45#[cfg(test)]
46mod tests {
47    use super::*;
48
49    #[test]
50    fn test_2414() {
51    }
52}
53


Back
© 2025 bowen.ge All Rights Reserved.