← Capital One Interview Insights

Capital One·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Interviewed for a software engineer role at Capital One and got a pretty straightforward coding problem. Nothing that'll make you sweat if you've done any array work before.

Questions Asked (1)

Q1

Given a list of numbers, write a function to count how many of them have an odd number of digits.

Algorithms & Data Structures
Author's notes

Simpler than it sounds.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the problem constraints (e.g., input size, number range, negative numbers) and then propose an efficient solution that avoids converting numbers to strings by using logarithms or digit-count logic. Walk through the algorithm step-by-step, analyze time and space complexity, and discuss edge cases.

Pro tip: Mention that using Math.log10 is efficient but be aware of floating-point precision issues for very large numbers; alternatively, use integer division by 10 in a loop to count digits, which is safe and still O(d) per number. Also, consider if the list can be processed in a single pass.

1. Clarify requirements and constraints

Ask about input size, number range (including negatives and zero), and whether the list can be modified. Confirm that 'odd number of digits' means the count of digits is odd (e.g., 1, 3, 5...).

2. Choose an approach to count digits

Decide between converting to string (simple but less efficient) or using mathematical operations (e.g., log10 or repeated division). Discuss trade-offs.

3. Design the algorithm

Iterate through the list, for each number compute its digit count, check if odd, and increment a counter. Handle edge cases like 0 (1 digit) and negative numbers (use absolute value).

4. Analyze complexity and optimize

State time complexity O(n * d) where d is average digits per number, or O(n) if using log10. Space complexity O(1). Mention potential optimizations like early termination if only need count.

5. Test with examples and edge cases

Walk through a small example (e.g., [1, 22, 333]) and test edge cases: empty list, single element, zero, negative numbers, large numbers.

Key Points to Mention

  • Handling negative numbers by taking absolute value before counting digits.
  • Special case for zero: it has 1 digit (odd).
  • Using Math.log10 for O(1) digit count per number, but noting precision issues for very large numbers.
  • Alternative: integer division loop for digit counting, which is safe and O(d) per number.
  • Time complexity: O(n) if using log10, O(n*d) if using division loop; space O(1).
  • Edge cases: empty list, single-digit numbers, numbers with leading zeros (not applicable for integers), and very large numbers.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.