Loading practice problems…
Loading your practice workspace…
Loading code editor…
12 / 29
Sign in
Algorithms/Linear Search

Find Numbers with Even Number of Digits

easy15 min

Given an array of positive integers, return how many values contain an even number of decimal digits.

Inspect each value and count only those with 2, 4, 6, or another even number of digits.

Example 1

Inputnums = [12, 345, 2, 6, 7896]

Output2

Example 2

Inputnums = [555, 901, 482, 1771]

Output1

Constraints

  • 1 ≤ nums.length ≤ 500
  • 1 ≤ nums[i] ≤ 100,000
Linear SearchArrays