There are N competitors in an exam .Each competitor has his own skill value which is given by the array s=s1,s2,....sN where s1 is the skill of the first competitor,s2 is the skill of second competitor and so on.. Two competitors are said to be tough competitors if their skill difference is least i.e. they are very close in their skill values.Given N and an array s as input,find the tough competitors among the N competitors and print the absolute of the difference of their skill values.

**Input:**

First line of the input contains an integer T denoting the number of test cases. Then T test cases follow. First line of every test case consists of an integer N, denoting number of competitors. Second line of every test case consists of N spaced separated integers, denoting the skill values of the competitors.

**Output:**

Corresponding to each test case, print the difference of the skill values of the tough competitors in a new line.

**Constraints:**

1<=T<=100

2<=N<=100

1<=Si<=10000

**Example:**

**Input:**

2

4

9 4 12 6

5

4 9 1 32 12

**Output:**

2

3

**Explanation:**

In the first case |9-4|=5 ,|9-12|=3,|9-6|=3,|4-12|=8,|4-6|=2,|12-6|=6 so,the tough competitors are competitors having skill values 4,6 having their skill difference as 2.

In the second case tough competitors are competitors having skill values (4,1) and (9,12) having their skill difference as 3.

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

_Shubham_Jain_06 | 404 |

maggiiiii | 315 |

Savage_19 | 310 |

ritikdagar0203 | 241 |

thanuvinu94 | 233 |

Bishnu Dev Panda | 810 |

_Shubham_Jain_06 | 715 |

okayboss | 652 |

maggiiiii | 598 |

Savage_19 | 576 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4925 |

Quandray | 4547 |

Login to report an issue on this page.