1. leetcode每日一题
emm题目倒是不难,但是按要求就很难了,这我自己肯定想不到
就一行代码,精妙啊哈哈
class Solution:
def singleNumber(self, nums: List[int]) -> int:
return reduce(lambda x, y: x ^ y, nums)
reduce
原来这个只是看着精简,还挺耗时啊
【Python基础】reduce函数详解_python reduce函数_走召大爷的博客-CSDN博客
lambda
Python学习系列之lambda表达式_python lambda表达式-CSDN博客