3.无重复字符的最长子串 修改

This commit is contained in:
游由 2021-11-18 09:27:29 +08:00
parent 5c2f228b54
commit 32457451e2
1 changed files with 2 additions and 5 deletions

View File

@ -65,7 +65,7 @@ impl Solution {
if k < o {
k = o;
} else {
ret = std::cmp::max(ret, i as i32 - k);
ret = ret.max(i as i32 - k);
}
map[s[i] as usize] = i as i32;
}
@ -80,9 +80,6 @@ mod test {
#[test]
fn test_q0003() {
let s = "tmmzuxt".to_string();
let substring_len = Solution::length_of_longest_substring(s);
//println!("{}", substring_len);
assert_eq!(substring_len, 5);
assert_eq!(Solution::length_of_longest_substring("tmmzuxt".to_string()), 5);
}
}