이 문제는 리스트에 문자열이 짝수인 것의 갯수를 구하는 문제입니다.
class Solution:
def findNumbers(self, nums: List[int]) -> int:
result = 0
for i in nums:
if len(str(i)) % 2 == 0:
result += 1
return result
숫자를 문자열로 바꾸고 짝수의 갯수를 구하면 됩니다.
'알고리즘 > 배열(array)' 카테고리의 다른 글
Duplicate Zeros python (0) | 2023.06.26 |
---|---|
Squares of a Sorted Array (0) | 2023.06.26 |
Max Consecutive Ones python (0) | 2023.06.26 |
백준 1546 python (0) | 2023.06.13 |
백준 10811 python (0) | 2023.06.13 |