Python code using set give me wrong anwsers

  • 0
    class Solution(object):
        def removeDuplicates(self, nums):
            return len(set(nums))

    I'm wondering why python gives me this wrong answers.

  • 0

    I faced the same problem. I found out that I had to modify nums. But nums = set(nums) still did not give me a right answer. Anyway, you need to modify nums.

Log in to reply

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