LeetCode Problem - Link


Another problem - Find Numbers with Even Number of Digits from LeetCode's 101 Array course.

This was a pretty easy one to solve, You simply loop through all the numbers, in my case, I converted every number to a string checked if the string length was even, and added it to counter if it was a match.


Sequential Approach

/**
 * @param {number[]} nums
 * @return {number}
 */
var findNumbers = function(nums) {
    let even_number_counter=0;
    nums.map((num)=>{
        let string = String(num)
        if(string.length %2 ===0){
            even_number_counter += 1
        }
    })
    return even_number_counter
};