Problem · Array

Count Numbers with an Even Digit Count

Learn this problem
EasyByteDance logoByteDanceNEW GRADOA

Problem statement

Given an array of positive integers numbers, count how many elements have an even number of decimal digits.

Return that count.

Function

countEvenDigitNumbers(numbers: int[]) → int

Examples

Example 1

numbers = [12, 134, 111, 1111, 10]return = 3

The values 12, 1111, and 10 have two, four, and two digits, respectively.

Example 2

numbers = [1, 10, 999, 1000, 10000]return = 2

Only 10 and 1000 have an even number of digits.

Constraints

  • 1 <= numbers.length <= 1000
  • 1 <= numbers[i] <= 10^4

More ByteDance problems

drafts saved locally
public int countEvenDigitNumbers(int[] numbers) {
    // Write your code here.
}
numbers[12, 134, 111, 1111, 10]
expected3
checking account