class Solution(object): def singleNumber(self, nums): """ :type nums: List[int] :rtype: int """ return (3* sum(set(nums)) - sum(nums))/ (3*len(set(nums)) - len(nums))
the question does not say the number show once or twice.
If only show once, your solution is incorrect.
Good point, actually, if only show once, above solution is correct, but if show twice, it is wrong.
I have modified the solution.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.