Problem Specification


  • 0
    J

    So my question is pretty straightforward: what exactly is the OJ looking for as output?

    I've tried three different methods, each of which return an integer, as specified by the docstring, which abides by the question as stating, "[y]our function should return length = 2. [...] It doesn't matter what you leave beyond the new length." Whereas my solutions correctly count the unique elements, the expected output returns a list. Hence, I'm unable to complete this problem. My first two methods utilized the bitwise XOR -- perhaps that is the wrong way to go. However, the below method should work, but it doesn't either:

            ## pythonic solution
            return len(set(nums))
    

    Where have I gone wrong?


Log in to reply
 

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