重铸华农荣光 我辈义不容辞
the sixth day-double pointer-longest continuous non-repeating substring
#include<iostream>
using namespace std;
const int N=100010;
int a[N],s[N];
int n,ans;
int main()
{
cin>>n;
for(int i=0;i<n;i++) cin>>a[i];
for(int i=0,j=0;i<n;i++){
s[a[i]]++;
while(s[a[i]]>1){
s[a[j]]--;
j++;
}
ans=max(ans,i-j+1);
}
cout<<ans;
return 0;
}