BETA

Difficulty Level: Easy

Submissions: 228 Accuracy:

39.47%

k modulus array element
       

Given an array of n integers. We need to count all values of ‘k’ such that

arr[0] % k = arr[1] % k = ....... = arr[n-1] % k 

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an integer n denoting the size of the array. The next line contains n space separated integers.

Output:
Print the count of values of k such that each element of array mod k is equal.

Constraints:
1<=T<=10^5
1<=n<=10^5
1<=a[i]<=10^5

Example:
Input:

3

38 6 34

2

3 2

Output:
3
1

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Ayush Govil

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.