Contains Duplicate II


  • 0
    V

    I see that the Contains Duplicate has a test case which is incorrect:
    [99,99]
    2

    Also they have test case like this:
    [-1,-1]
    1

    which I feel is contradictory.

    The problem states that we need to find two indices i and j such that nums[i] == nums[j] and the absolute difference is (i - j) == k

    When there are two elements in the array the absolute difference can be only 1. How can it be both 1 and 2.

    I don't know whether i am missing something here.


  • 0
    V

    @venknar Sorry, I was wrong. It says atmost K. Got it. Please ignore.


Log in to reply
 

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