int h[10]={0};
int main()
{
int C;
scanf("%d",&C);
while(C--)
{
int n , m;
int i=0;
int notvalid=-1;
int count=0;
scanf("%d %d",&n,&m);
int k=0;
int a=0;
for(n;n<m;n++)
{
a=n;
while(a>0)
{
h[a%10]++;
if(h[a%10]>1)
{
notvalid=1;
break;
}
a=a/10;
}
if(notvalid==1)
notvalid=-1;
else
count++;
for(k=0;k<10;k++)
h[k]=0;
}
printf("%d\n",count);
}
return 0;
}
subitting this code gives wrong answer though critical cases giving correct answer
as
1 5000
1 1
99 99
1 9
10 100
gives output
2754
1
0
9
81
whats wrong ??
![:cry:](./images/smilies/icon_cry.gif)