# Is there an assumption that j should be greater than i?

• I failed at a case similar to the following:

{2,3}, k=1, t=-1, expected output: false

It seems the difference is computed as follows

difference = nums[j] - nums[i] where j > i

otherwise I should be able to pass the test case because nums[0] - nums[1] <= -1

If that's the case, please make it clear in the description

• Actually, I think your question would be a good clarification question to ask during an interview.

• I do believe that the 'difference between a and b' is a somewhat ambiguous usage without enough context. In daily usage, when people talk about difference between a and b, they really just mean |a-b| (or |b-a|). However, when used in the algebra textbook, it usually means a - b (see this thread for some discussion).

Therefore, it is something you definitely would like your interviewer to clarify before writing the code. I personally interpret 'difference' as a positive number, and would have the function return false immediately on t < 0 and k < 0. And my program based on this logic got AC. I think either this is what the problem really means, or it lacks proper test cases to guard itself from such a solution.

• Can't agree more.

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.