Datawhale编程实践(LeetCode 腾讯精选练习50)Task11

1.只出现一次的数字https://leetcode-cn.com/problems/single-number/

看到“你的算法应该具有线性时间复杂度。 你可以不使用额外空间来实现吗?”我也想了很久,想不出答案,最终看了解答

位运算和异或运算确实之前没有接触过,这里让我大开眼界

1 class Solution:
2     def singleNumber(self, nums: List[int]) -> int:
3         return reduce(lambda x, y: x ^ y, nums)

随后对异或运算及其作用进行了学习https://blog.csdn.net/weixin_44731100/article/details/89156141

复习了python

lambdahttps://www.cnblogs.com/evening/archive/2012/03/29/2423554.html

reduce函数https://www.runoob.com/python/python-func-reduce.html

2.环形链表https://leetcode-cn.com/problems/linked-list-cycle/

3.环形链表 IIhttps://leetcode-cn.com/problems/linked-list-cycle-ii/

原文地址:https://www.cnblogs.com/zmbreathing/p/datawhale_leetcode_task11.html