The difference between i and j is ambiguous


  • 0
    C

    I found the difference between nums[i] and nums[j] can be negative in the problem Contains Duplicate III. So if the difference between i and j can be negative, the result will be really different in this problem.

    [1, 0, 1]
    1

    results in answer true because 0 - 2 = -2 < 1?

    The difference between i and j should be restricted to be non-negative.


  • 0
    C

    Another explanation:

    The bound can be negative but the difference is regarded to be non-negative?


Log in to reply
 

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