OJ Giving Wrong Error. Help

  • 0
    def removeDuplicates(self, nums):
        :type nums: List[int]
        :rtype: int
        nums =set(nums)
        return len(nums)

    Im getting an error that says:
    Input = [1,1,2]
    Output = [1,1]
    Expected = [1,2]

    How can that be the output when I'm converting my list into a set?

  • 0

    Its because set creates a new list. Found the answer to a previous question. Sorry for posting the question again.

Log in to reply

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