← Microsoft Interview Insights

Microsoft·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Jul 2026

Summary

Microsoft SWE coding round, one parsing question the whole time. Seemed straightforward at first but the '*' separator twist made it messier than expected.

Questions Asked (1)

Q1

Write a function to parse a string into tokens, where tokens are split by spaces normally, but if a '*' character appears in a segment, it acts as the delimiter instead of spaces.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I read the examples a couple times before I felt like I actually understood what was being asked.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the exact tokenization rules with the interviewer, especially edge cases like consecutive delimiters and empty tokens. Then, outline a single-pass algorithm that scans the string, identifies the delimiter for each segment, and splits accordingly, discussing time and space complexity.

Pro tip: Mention that you'd write unit tests for edge cases like leading/trailing delimiters and multiple '*' characters, showing you think about robustness and production quality.

1. Clarify requirements and edge cases

Ask questions to confirm how tokens are defined: Are empty tokens allowed? How are consecutive delimiters handled? What if '*' appears multiple times in a segment?

2. Design the algorithm

Propose a linear scan approach: iterate through the string, determine the delimiter for the current segment (space or '*'), and split accordingly. Consider using a state machine or regex.

3. Analyze complexity and trade-offs

Discuss time complexity O(n) and space complexity O(n) for the output. Compare regex vs manual parsing in terms of readability, performance, and maintainability.

4. Implement and test

Write clean code with meaningful variable names. Walk through examples, including edge cases, to verify correctness.

Key Points to Mention

  • Definition of a token and delimiter precedence: '*' overrides spaces within a segment.
  • Handling of consecutive delimiters and empty tokens (e.g., 'a**b' or 'a b').
  • Time and space complexity analysis (O(n) time, O(n) space).
  • Choice between regex and manual parsing, with trade-offs.
  • Edge cases: leading/trailing delimiters, multiple '*' in a segment, empty input.
  • Testing strategy: unit tests for normal and edge cases.

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