The problem is NOT clear


  • 0
    S

    See if inputs are as follows:
    [3,1,4,1,1,1,5]
    0
    the result should be (4*3)/2.
    Generally speaking, n is the number of duplicate elements, for k == 0, it should be n * (n-1) / 2


  • 0

    Shouldn't you then also say that the result of the first example should be 4 instead of 2? In other words, I think example 1 shows that you're wrong.


Log in to reply
 

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