Problem Link->https://www.codechef.com/problems/LEDIV/

My Solution–>

#include<iostream.h>

#include<stdio.h>

int main()

{

```
int t=0;
cin>>t;
while(t!=0)
{
int n=0;
scanf("%d",&n);
int min=100001;
long *arr=new long[n];
for(int i=0;i<n;i++)
{
scanf("%ld",&arr[i]);
if(arr[i]<min)
min=arr[i];
}
int i=2;
int count=0;
int ans=0;
```

bool flag=false;

```
while(i<=min && flag==false)
{
count=0;
for(int k=0;k<n;k++)
{
if(arr[k]%i==0)
count++;
}
if(count==n)
{
ans=i;
flag=true;
break;
}
i++;
}
if(flag==true)
printf("%d",ans);
else
printf("-1");
t--;
printf("\n");
}
return 0;
}
```