My issue
why my code printing 2 for 2nd testcase also
My code
#include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n,i,j;
scanf("%d",&n);
int a[n];
for( i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
int count=0;
for(j=i+1;j<n;j++)
{
if(a[i]==a[j])
{
count++;
break;
}
}
printf("%d\n",n-count);
}
}
Learning course: Arrays, Strings & Sorting
Problem Link: Devu and friendship testing Practice Problem in Arrays, Strings & Sorting - CodeChef