Since the array is sorted the farthest points will be a [ i ] and a [ k ] ;
mostDistantDistance = arr [ k ] - arr [ i ] NEW_LINE if ( mostDistantDistance <= L ) : NEW_LINE INDENT ways += 1 NEW_LINE DEDENT return ways NEW_LINE