data[0] = 78 > 20 = data[14]
If i = 0 and j = 14 then data[i] <= data[j] is false, as data[i] = 78. Thus j - i is not to be considered.
i = 0
j = 14
data[i] <= data[j]
data[i] = 78
j - i
If conversely i = 14 and j = 0 then data[i] <= data[j] is true. However j-i = 0-14 = -14 < 0, which means it is not the maximum.
i = 14
j = 0
j-i = 0-14 = -14 < 0
(We are supposed to find the maximum j-i with data[i] <= data[j], not the maximum abs(j-i))
j-i
abs(j-i)
What do you want to be checked? I saw that you passed the kata... Furthermore asking for something is not an issue, sorry!
Loading collection data...
data[0] = 78 > 20 = data[14]
If
i = 0
andj = 14
thendata[i] <= data[j]
is false, asdata[i] = 78
. Thusj - i
is not to be considered.If conversely
i = 14
andj = 0
thendata[i] <= data[j]
is true. Howeverj-i = 0-14 = -14 < 0
, which means it is not the maximum.(We are supposed to find the maximum
j-i
withdata[i] <= data[j]
, not the maximumabs(j-i)
)What do you want to be checked? I saw that you passed the kata... Furthermore asking for something is not an issue, sorry!