My issue
my code is getting runtime error how to solve it
My code
#include<stdio.h>
#include <stdlib.h>
void main()
{
int t;
scanf("%d",&t);
int n;
for(int i=t;i>0;i--){
scanf("%d",&n);
int *arr = (int *)malloc(n * sizeof(int));
for(int k=0;k<n+1;k++){
scanf("%d",&arr[k]);
}
for(int u=0;u<n;u++){int r=0;
for(int h=0;h<n;h++){
if(arr[u]==arr[h]){
r++;
}
}
if (r%2==1){
printf("%d",arr[u]);
}
}
free(arr);
}
}
Learning course: Arrays, Strings & Sorting
Problem Link: Chef and Dolls Practice Problem in - CodeChef