← Microsoft Interview Insights

Microsoft·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
May 2026

Summary

Interviewed at Microsoft for a software engineering role and got a coding question around list manipulation. Pretty straightforward session, nothing too wild.

Questions Asked (1)

Q1

Given a list of integers, write code to find all numbers that appear an even number of times.

Algorithms & Data Structures
Author's notes

Went with a frequency map, count occurrences, then filter.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem: confirm whether the list can contain duplicates, negative numbers, and whether the output should be sorted or in any order. Then propose an efficient solution using a hash map to count frequencies, and iterate through the map to collect numbers with even counts. Discuss time and space complexity, and consider edge cases like empty list or all unique numbers.

Pro tip: Mention that you would use a hash map for O(n) time, but also note that if memory is constrained, sorting the list first (O(n log n)) could be a trade-off. This shows awareness of engineering trade-offs beyond just the optimal solution.

1. Clarify requirements

Ask about input constraints, expected output format, and whether the list can be modified. Confirm if numbers appearing zero times (i.e., not in list) should be considered.

2. Choose data structure

Decide between hash map (for O(n) time) or sorting (for O(n log n) time but O(1) extra space). Explain your choice based on typical constraints.

3. Implement algorithm

Write code to count frequencies using the chosen data structure, then iterate to collect numbers with even counts. Handle edge cases like empty list.

4. Analyze complexity

State time and space complexity of your solution. Discuss potential optimizations or alternative approaches.

5. Test with examples

Walk through a few test cases, including duplicates, all unique, and empty list, to verify correctness.

Key Points to Mention

  • Hash map frequency counting for O(n) time complexity
  • Edge cases: empty list, all unique numbers, negative numbers
  • Time and space complexity analysis (O(n) time, O(n) space for hash map)
  • Alternative approach using sorting (O(n log n) time, O(1) extra space)
  • Output format: list of numbers with even frequency, order doesn't matter unless specified
  • Handling of numbers that appear zero times (not in list) - typically not included

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