Whats wrong with this solution of HORSES

Submission says wrong answer but I cant figure out why its wrong. Please help.
#include<stdio.h>
#include<limits.h>
int main(){
int n,m,k;
scanf("%d\n",&n);
for(int i=0; i<n; i++,k=INT_MAX){
scanf("%d\n",&m);
int arr[m];
for(int i=0; i<m; i++){
scanf("%d",&arr[i]);
}
for(int i=0;i<m-1;i++){
for(int j=i+1;j<m;j++){
if(arr[j]>arr[i] && (arr[j]-arr[i])<k)
k=arr[j]-arr[i];
if(arr[i]>arr[j] && (arr[i]-arr[j])<k)
k=arr[i]-arr[j];
}
}
printf("%d\n",k);
}
return 0;}

You just forgot one condition where arr[i] == arr[j].
Here is your accepted solution.