Can any one tell me whats wrong with this code

,the question is to check the given two arrays have the same elements or not
bool check(vector arr, vector brr, int n) {
int flag=0;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
if(arr[i]==brr[j])
{
flag=1;
break;
}
}
if(flag==0)
{
break;
}
}
if(flag==0)
{
return false;
}
else
{
return true;
}

all the elements same or 1? share the question link

there is mistake in your curly braces ! close them properly . their are odd no of braces

No I forgot to copy and paste the code properly missed those curly braces the error is segmentation fault it is showing