Find Numbers with Even Number of Digits

Problem Id: 1295 Difficulty: Easy Tag: Array


Intuition

Just convert each number to string and check if the length of the string is even.

Solution


class Solution:
    def findNumbers(self, nums):
        count = 0
        for num in nums:
            if len(str(num)) % 2 == 0:
                count += 1
        return count