Modulo M

3.6

18 votes
Easy
Problem

You are given N distinct Numbers: A_1 to A_N. Find the smallest number M such that the new sequence A_i % M is also unique.

Input:
First line contains integer T denoting the number of test cases. For each test case next line is the length of the sequence N followed by the sequence in next line.

Output:
For each test case print answer in separate lines.

constraints:
1<=N<=500

0<=A_i<=1000000

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?