Count Integers With an Even Decimal Length

Quick Overview

Count Integers With an Even Decimal Length. Return how many positive integers in nums have an even number of decimal digits.

Count Integers With an Even Decimal Length

Company: Google

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Other

### Problem Return how many positive integers in nums have an even number of decimal digits. Count each input occurrence separately. ```cpp class Solution { public: int findNumbers(vector<int>& nums); }; ``` ### Examples **Example 1:** ```text Input: nums = [9,10,100,1000,100000] Output: 3 Explanation:10 has2 digits,1000 has4,and100000 has6. ``` **Example 2:** ```text Input: nums = [1,999,12345] Output: 0 Explanation: Their digit counts1,3,5 are all odd. ``` ### Constraints - There are 1 to 500 values. - Each is an integer in `[1,100000]`. ### Contract considerations Inputs are positive integers, so leading-zero text is not part of the representation. ```hint Read the boundary condition Are equal input values counted by occurrence, and can leading-zero text affect a positive integer’s digit length? ``` ### Boundary reminders Inputs are positive integers, so leading-zero text is not part of the representation.

Overview: Count Integers With an Even Decimal Length. Return how many positive integers in nums have an even number of decimal digits.

Google logo
Google
Jun 13, 2026
easySoftware EngineerOtherCoding & Algorithms
0
0

Problem

Return how many positive integers in nums have an even number of decimal digits. Count each input occurrence separately.

class Solution {
public:
    int findNumbers(vector<int>& nums);
};

Examples

Example 1:

Input: nums = [9,10,100,1000,100000]
Output: 3
Explanation:10 has2 digits,1000 has4,and100000 has6.

Example 2:

Input: nums = [1,999,12345]
Output: 0
Explanation: Their digit counts1,3,5 are all odd.

Constraints

  • There are 1 to 500 values.
  • Each is an integer in [1,100000] .

Contract considerations

Inputs are positive integers, so leading-zero text is not part of the representation.

Boundary reminders

Inputs are positive integers, so leading-zero text is not part of the representation.