We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ba83b3a commit 0195458Copy full SHA for 0195458
problems/136.single-number.md
@@ -118,13 +118,6 @@ class Solution:
118
for num in nums:
119
single_number ^= num
120
return single_number
121
-
122
-# 另一种思路:集合是无序不重复的元素集
123
-# 利用这一特性将列表转化成不包含重复元素的集合
124
-# 分别对集合和列表进行求和,集合元素之和 x2 减去列表元素之和即为只出现了一次的元素
125
-class Solution:
126
- def singleNumber(self, nums: List[int]) -> int:
127
- return 2 * sum(set(nums)) - sum(nums)
128
```
129
130
## 延伸
0 commit comments