Find Numbers with Even Number of Digits

Given an array nums of integers, return how many of them contain an even number of digits.

30:00

Find Numbers with Even Number of Digits
easy
Free written solution
Topics
Companies

Given an array nums of integers, return how many of them contain an even number of digits.

Example 1:
Input: {"nums":[12,345,2,6,7896]}
Output: 2
Constraints:
  • 1≤nums.length≤5001 \leq \text{nums.length} \leq 500

  • 1≤nums[i]≤1051 \leq \text{nums}[i] \leq 10^5

Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result

Run code to see results.

Input
arr ={"nums":[12,345,2,6,7896]}

nums (5)

12
345
2
6
7896

bench: num //= 10

waiting for the first number

even digit count

0

odd digit count

0

count starts at 0. Each of the 5 numbers will have its digits chopped off one at a time.

Variables
VariableValue
count0
DepthFunction Call
Stack empty
0/24