1 parent 83f19f1 commit e76e5c5Copy full SHA for e76e5c5
2 files changed
python/index.py
@@ -268,3 +268,6 @@ def replaceDigits(s: str) -> str:
268
# print(replaceDigits(s))
269
270
271
+a = [12,6,3]
272
+b = map(lambda x: x * 2, a)
273
+print(list(b))
python/leetcode/list/136.py
@@ -0,0 +1,21 @@
1
+def singleNumber(nums: List[int]) -> int:
2
+ '''
3
+ 136. Single Number
4
5
+ # 找出只出現一次的元素
6
+ # ans = 0
7
+ # for key,value in Counter(nums).items():
8
+ # if(value == 1):
9
+ # ans = key
10
+ # return ans
11
+
12
+ # solution 2
13
+ ans = 0
14
+ for i in nums:
15
+ ans ^= i
16
+ return ans
17
18
19
+nums = [4,1,2,1,2]
20
+# 4
21
+print(singleNumber(nums))
0 commit comments