Challenge: Given an array nums of integers, return how many of them contain an even number of digits.
This was pretty straightforward. Again, I did it in Python. Perhaps it's time I started working on these in C#. It would be a good way of trying to relearn C# and have a deeper understanding of the language.
class Solution:
def findNumbers(self, nums: List[int]) -> int:
count = 0
for num in nums:
if len(str(num))%2 ==0:
count +=1
return count
Comments
Post a Comment