1163. Last Substring in Lexicographical Order Hard

@problem@discussion
#Two Pointers#String



1/**
2 * [1163] Last Substring in Lexicographical Order
3 *
4 * Given a string s, return the last substring of s in lexicographical order.
5 *  
6 * Example 1:
7 * 
8 * Input: s = "abab"
9 * Output: "bab"
10 * Explanation: The substrings are ["a", "ab", "aba", "abab", "b", "ba", "bab"]. The lexicographically maximum substring is "bab".
11 * 
12 * Example 2:
13 * 
14 * Input: s = "leetcode"
15 * Output: "tcode"
16 * 
17 *  
18 * Constraints:
19 * 
20 * 	1 <= s.length <= 4 * 10^5
21 * 	s contains only lowercase English letters.
22 * 
23 */
24pub struct Solution {}
25
26// problem: https://leetcode.com/problems/last-substring-in-lexicographical-order/
27// discuss: https://leetcode.com/problems/last-substring-in-lexicographical-order/discuss/?currentPage=1&orderBy=most_votes&query=
28
29// submission codes start here
30
31impl Solution {
32    pub fn last_substring(s: String) -> String {
33        String::new()
34    }
35}
36
37// submission codes end
38
39#[cfg(test)]
40mod tests {
41    use super::*;
42
43    #[test]
44    fn test_1163() {
45    }
46}
47


Back
© 2025 bowen.ge All Rights Reserved.