Given an array of N integers. a[1]%K = a[2]%K = a[3]%K = .... a[n]%K 1) 1<K<N, 1< N<10^6, 1<a[i]<10^9 2) How will you find all possible values for K? P.S : No brute force approach. asked 09 Aug, 19:11

Hint: if $a_1 \text{ mod } K = a_2 \text{ mod } K$, then $(a_1  a_2) \text{ mod } K = 0$. Therefore $K$ has to be a divisor of $a_1  a_2$. answered 10 Aug, 03:19
