← Microsoft Interview Insights

Microsoft·Software Engineer·Online Assessment (OA)·Junior

JuniorRejected
Jun 2024Remote

Summary

Applied to Microsoft through their portal, got an OA with two medium-level coding problems (one graph, one DP), passed all test cases, and then got marked 'Not Selected' about ten days later. The kicker is the job posting was reopened right after, which makes zero sense to me.

Questions Asked (2)

Q1

Graph-based coding problem (medium difficulty) given as part of the online assessment.

Algorithms & Data Structures
Author's notes

Passed all test cases on this one so I can't really complain about my solution.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem constraints and edge cases, then identify the graph type (directed/undirected, weighted/unweighted) and choose the appropriate algorithm (BFS, DFS, Dijkstra, topological sort, etc.). Implement the solution with clean code, analyze time and space complexity, and test with examples including edge cases.

Pro tip: Microsoft interviewers value clean, bug-free code and clear communication; before coding, briefly outline your plan and after coding, walk through a test case to demonstrate correctness.

1. Clarify the problem

Ask questions to understand input format, constraints, edge cases, and expected output. Confirm whether the graph is directed/undirected, weighted/unweighted, and if there are any special conditions.

2. Identify the graph problem type

Determine if it's a traversal, shortest path, connectivity, cycle detection, topological sort, or something else. This guides algorithm selection.

3. Choose algorithm and data structures

Select the optimal algorithm (e.g., BFS for unweighted shortest path, DFS for cycle detection) and appropriate data structures (adjacency list, queue, stack, priority queue, visited set).

4. Implement and test

Write clean, modular code with meaningful variable names. Test with provided examples and edge cases (empty graph, disconnected components, cycles).

5. Analyze complexity and optimize

State time and space complexity. If needed, discuss potential optimizations or alternative approaches.

Key Points to Mention

  • Graph representation: adjacency list vs. adjacency matrix and trade-offs
  • Algorithm choice: BFS, DFS, Dijkstra, Bellman-Ford, topological sort, Union-Find
  • Handling edge cases: empty graph, disconnected components, cycles, self-loops
  • Time and space complexity analysis
  • Code clarity and modularity
  • Testing strategy: walk through examples and edge cases

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

Q2

Dynamic programming coding problem (medium difficulty) given as part of the online assessment.

Algorithms & Data Structures
Author's notes

DP problems are hit or miss for me but this one clicked.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem constraints and edge cases, then define the state and recurrence relation before coding. Implement the DP solution iteratively, optimizing space if possible, and test with small examples to verify correctness.

Pro tip: In an online assessment, prioritize a correct and efficient solution over premature optimization; write clean code with meaningful variable names and handle edge cases explicitly to avoid hidden test failures.

1. Understand the problem

Restate the problem in your own words, identify input/output, and ask clarifying questions about constraints, edge cases, and expected time/space complexity.

2. Define the DP state

Determine what each state represents (e.g., dp[i] = optimal solution for first i elements) and how it relates to subproblems.

3. Formulate recurrence relation

Derive the transition between states, considering all possible choices at each step, and establish base cases.

4. Implement and optimize

Code the DP solution, starting with a straightforward top-down or bottom-up approach, then optimize space or time if needed.

5. Test and validate

Run through small examples, edge cases (empty input, single element, large values), and verify against a brute-force solution if possible.

Key Points to Mention

  • Optimal substructure and overlapping subproblems
  • Time and space complexity analysis (e.g., O(n^2) to O(n) optimization)
  • Choice of top-down (memoization) vs bottom-up (tabulation) approach
  • Handling edge cases like empty input or negative values
  • Space optimization techniques (e.g., using rolling arrays)
  • Clear variable naming and code readability

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