Skip to main content
Back to problems
#1295
Easy Algorithms

Find numbers with even number of digits

Array Math
79.7% acceptance
Feb 25, 2026
2928
149
Given an array nums of integers, return how many of them contain an even number of digits.

Solution

Rust
Time O(n)
Space O(1)
LeetCode
solution.rs
impl Solution {
  pub fn find_numbers(nums: Vec<i32>) -> i32 {
    nums.iter().filter(|&&x| {
      let digits = x.to_string().len();
      digits % 2 == 0
    }).count() as i32
  }
}