题目描述
给定一个长度为 n 的整数序列,请找出最长的不包含重复的数的连续区间,输出它的长度。
include [HTML_REMOVED]
include [HTML_REMOVED]
include [HTML_REMOVED]
include [HTML_REMOVED]
using namespace std;
const int N = 100010;
int s[N];
int a[N];
int n;
int main()
{
cin>>n;
for(int i=0;i[HTML_REMOVED]>a[i];
}
int res=0;
for(int i=0,j=0;i[HTML_REMOVED]1)
{
s[a[j]]–;
j++;
}
res=max(res,i-j+1);
}
cout<<res;
return 0;
}