Brute Force, Maths.
Given a 2D array, print the maximum value of the length of jump to be chosen such that it is possible to visit few preselected positions. The direction of movement is allowed in both directions.
The solution would be the greatest common divisor of given positions, which are selected to be visited. Then movement to each of them is possible.
The statement had a bug, in the explanation part.
from math import gcd def gcd1(a,n): if(n==1): return a else: f=a for i in range(1,n): f=gcd(f,a[i]) return f n,x=map(int, input().split()) l=list(map(int, input().split())) #print(n) #print(n,x,l) l.sort() f= for i in range(n): f.append(abs(l[i]-x)) print(gcd1(f,n))