Consider an array of distinct positive integers where elements are sorted in ascending order. We want to find all the subsequences of array consisting of exactly m elements. For example, given array a=[1,2,3,4], the subsequences consisting m=3 elements are [1,2,3], [1,2,4], [1,3,4], and [2,3,4]. Once we have all of the m-element subsequences, we find the value of globalMaximum using the following pseudocode:

globalMaximum = 0

for each subsequence, s, consisting of m elements {
currentMinimum = 10¹⁸

for each (x,y) pair of elements in subsequence s {
absoluteDifference = abs(x - y)

if absoluteDifference < currentMinimum {
currentMinimum = absoluteDifference
}
}

if currentMinimum > globalMaximum {
globalMaximum = currentMinimum
}
}

For example, given the array a = [2,3,5,9] and a length m = 3, first find all subsequences of length m.