We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5d88de6 commit 9072b09Copy full SHA for 9072b09
45. 只出现一次的数字.md
@@ -0,0 +1,11 @@
1
+***给定一个非空整数数组,除了某个元素只出现一次以外,其余每个元素均出现两次。找出那个只出现了一次的元素。***
2
+
3
+```
4
+class Solution:
5
+ def singleNumber(self, nums: List[int]) -> int:
6
+ #异或运算
7
+ ans = nums[0]
8
+ for num in nums[1:]:
9
+ ans = ans^num
10
+ return ans
11
0 commit comments