easyLoops and basicsBits and math target 15 min
Numbers with an even digit count
nums is a list of whole numbers, none of them negative. A number's digit count is how many digits it has when written the usual way, with no leading zeros: 47 has two digits, 305 has three, and 0 has one.
Return how many numbers in nums have an even digit count. An empty list gives 0. Leave nums unchanged: the caller may still need it.
Example 1
Input
nums = [47, 305, 8, 1234]Output247 has 2 digits and 1234 has 4, both even. 305 has 3 and 8 has 1, both odd.
Example 2
Input
nums = [10, 99, 100, 7000]Output310 and 99 have 2 digits and 7000 has 4. 100 has 3.
Example 3
Input
nums = [0, 5, 600]Output00 and 5 have one digit each and 600 has three, so none of them counts.
Constraints
0 ≤ len(nums) ≤ 105
0 ≤ nums[i] ≤ 109
Plan it first
Write a line for each before you code, then say them out loud. Compare with the Approach tab afterwards.
Run examples checks the examples. Submit runs every test, including edge cases and, when the problem has one, a speed check on a large input.