FastPrepCount Numbers with Even Number of Digits

Count Numbers with Even Number of Digits

Capital One logoCapital One● EasyFULLTIMEOA
Learn

Problem statement

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

The number of digits of a positive integer x is the length of its base-10 decimal representation. For example, 7 has 1 digit, 12 has 2 digits, and 1111 has 4 digits.

The function receives the full standard input as a single string (space-separated integers) and must return the exact standard output lines for the described problem.

Function

solveOneCountEvenDigitNumbers(input: String) → String[]

Examples

Example 1

input = "12 345 2 6 7896"return = ["2"]

The returned string must match the expected standard output for the sample input.

Constraints

  • 1 ≤ numbers.length ≤ 1000
  • 1 ≤ numbers[i] ≤ 104

More Capital One problems

See Capital One hiring insights
public String[] solveOneCountEvenDigitNumbers(String input) {
    // write your code here
}
input"12 345 2 6 7896"
expected["2"]
Checking account…