LeetCode - 统计位数为偶数的数字(No.1295)

1295 - 统计位数为偶数的数字

  • date : Dec.31st, 2019
  • platform : windows

problem description

给你一个整数数组 nums,请你返回其中位数为 偶数 的数字的个数。

thinking

==python== is so powerful !!!

code

class Solution:
    def findNumbers(self, nums: List[int]) -> int:
        return sum(map(lambda x: len(str(x)) & 1 ^ 1, nums))

猜你喜欢

转载自www.cnblogs.com/litun/p/12127886.html