Why [], 0, 0 should return False?


  • 0
    G

    Input: [], 0, 0
    Output: true
    Expected: false


  • 2
    P

    The question reads

    find out whether there are two distinct indices i and j in the array
    such that the difference between nums[i] and nums[j] is at most t and
    the difference between i and j is at most k

    and there are NO such two distinct indices in an empty array can satisfy the requirement, therefore should return false

    (Similarly, an array with only 1 element would never satisfy the requirement, either.)


Log in to reply
 

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