while(chs[index1]!=chs[index2]){
set.remove(chs[index1]);
index1++; //找到相等的那个字符;
}
set.remove(chs[index1]);
<p> index1++;</p><p>其中在相等字符之前的字符也要从set集合中删除掉;</p>
题目3Longest Substring Without Repeating Characters
最新推荐文章于 2025-05-18 01:04:12 发布