[
array
]
BinarySearch 0188 Odd Number of Digits
Problem statement
https://binarysearch.com/problems/Odd-Number-of-Digits/
Solution
Just calculate number of digits for every number.
Complexity
It is O(n * log k) for time and O(1) for space, where k is the biggest number in array.
Code
class Solution:
def solve(self, nums):
return sum(len(str(x)) % 2 == 1 for x in nums)