Count Numbers With Odd Zeros
Company: Capital One
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Quick Answer: This question evaluates proficiency in numeric digit analysis and parity-based counting, testing the competency to reason about decimal representations of integers within the Coding & Algorithms domain at a practical application level. It is commonly asked to assess basic algorithmic thinking, efficient iteration and counting skills, and careful handling of edge cases in technical interviews.
Constraints
- 0 <= len(a) <= 100000
- 0 <= a[i] <= 1000000000
Examples
Input: ([20, 11, 10, 10070, 7],)
Expected Output: 3
Explanation: 20 has 1 zero, 10 has 1 zero, and 10070 has 3 zeros. These are the three numbers with an odd zero count.
Input: ([],)
Expected Output: 0
Explanation: An empty array contains no numbers, so the count is 0.
Hints
- Process each number digit by digit and count how many times digit 0 appears. Remember that the number 0 itself should count as one zero.
- You only need to know whether the zero count is odd or even, so you can track parity instead of storing the full count.