Company-Tagged — Microsoft & Amazon
Two transferable coding mocks: extend a pair-sum problem and reason through a grid traversal, then assess your explanations and failure cases without claiming current employer question-frequency data.
Original publication date unrecordedUpdated
Lesson preparation & details
Level: advanced
By the end, you should be able to
- Practice timing, company labels and readiness scores are self-assessment conventions, not validated hiring-frequency or success predictions
Bring with you
Sources checked: . A source check does not change the publication or update date.
Editorial review: · What review means
In this article · 18 sections
Prerequisites
Complete a mixed mock and retain the failure log. Know BFS/DFS, binary search, two pointers, heaps and dynamic programming well enough to state their preconditions. The historical slug is preserved for bookmarks; the lesson does not claim access to current Microsoft or Amazon question banks or a universal company-specific grading rubric.
Watch first (skim before the session)
Read the official problem statements, not a company-frequency list. If an employer supplies preparation guidance for your actual role and stage, use that dated guidance as a constraint. Practice-set selection below is the author's design, not hiring-frequency evidence.
Why this session exists
This mock trains two transferable delivery modes: extending a clean base implementation and explaining optimization through a chain of tradeoffs. Neither mode belongs exclusively to one employer. You will practice both and compare observable behavior rather than stereotypes.
Microsoft: style and staples
Use this preserved heading as Mock A: extension-driven. Begin with sorted Two Sum and state the elimination proof. Extend to returning original indices from unsorted input: sorting now changes identity, so compare a value/index sort with a hash map. Then handle duplicate values, no solution and multiple possible answers. The assessment is whether the new contract changes the algorithm and tests, not whether you guessed a company's preference.
Amazon: style and staples
Use this preserved heading as Mock B: tradeoff-driven. Start with Number of Islands. Define four-neighbor adjacency, land encoding, mutation policy and graph-size bounds. Present the repeated flood-fill invariant: each fresh unvisited land start identifies exactly one connected component. Compare recursion with an explicit stack for a long narrow island. Add a variant requiring the input board remain unchanged, then a variant asking shortest distance to the nearest source: the latter needs multi-source BFS rather than merely changing DFS output.
From first principles: why company-tagged practice works
A reliable role-specific constraint can inform practice, but an unattributed company tag is not reliable frequency data. Prioritize objective relevance × your demonstrated gap. If no validated frequency evidence exists, do not put an invented frequency in that product. Use the same unfamiliar problem family in different surface settings to test transfer rather than memorized wording.
Mental model
Treat every follow-up as a new contract. Write the old assumption, the requested change and the first counterexample to reusing the old solution. For example, two-pointer pair sum is justified by sortedness; it fails as a direct scan of [3,1,2] with target 3. BFS shortest-hop reasoning fails to minimize cost when a single edge costs 20 and a two-edge path costs 4.
Memory hook
Contract, invariant, cost, counterexample, test. These are prompts to expose reasoning, not magic interview words.
What reviewers actually ask (mixed mock)
- Pair-sum family: existence, indices, duplicates, then all unique triplets. Explain why each variant changes the output contract and sometimes the complexity.
- Grid-graph family: count components, preserve the board, handle deep regions, then nearest-source distances.
- Top-k family: compare sorting all items, a bounded heap and a streaming input that cannot be reread.
- Dynamic programming family: single-use versus reusable items, boolean reachability versus counting, and the direction of capacity updates.
Tradeoff
A full working brute-force baseline is useful when affordable, but writing an exponential implementation under a tiny time budget is not mandatory if a clear finite oracle already exists. Narrate the redundant work you eliminate. If memory is constrained, count Python slices and frequency maps rather than calling a solution constant-space because it has two pointers.
Timing rubric — the 75-minute session
Use 5 minutes for contract review, 25 minutes for Mock A, 25 minutes for Mock B, 10 minutes for cross-checks and 10 minutes for debrief. Adjust the durations to accessibility needs and the actual interview format. Stop a segment with an honest statement of what is incomplete rather than silently extending the timer and calling it a timed success.
Self-scoring — two scorecards
For each mock independently record: contract clarified; invariant justified; implementation matches the invariant; mutation and identity handled; ordinary and edge tests; time/space analysis; follow-up adaptation. Award a point only when you can point to an artifact or an explicit explanation. This is a self-assessment scale, not a hiring cutoff.
Common failure modes
- Treating company labels as a guarantee of which question will appear.
- Narrating syntax while leaving the decision rule unexplained.
- Changing code for a follow-up without revising its input/output contract.
- Claiming O(1) space while allocating a sorted copy or a slice.
- Replaying a familiar solution and calling it cold retrieval.
Recovery scripts
If stuck, say which invariant or subproblem is missing. Write a tiny exhaustive oracle and compare the disputed transition. For an indexing failure, trace the empty case, one element and two equal values. For a graph failure, draw one cycle, one disconnected vertex and one case where weighted and unweighted paths disagree.
In practice
Record observations from the actual mock rather than attributing them to a company's culture. A useful log says 'I assumed every edge had unit cost and failed the weighted counterexample'; it does not say 'I need to think more like company X'. Share recordings only with consent and remove confidential interview content.
Follow-up chains — have the next question ready
Sorted pair sum → unsorted indices → unique triplets → output-size lower bound. Components → clone with identity → multi-source shortest hops → weighted shortest path with named weight assumptions. Single-use subset sum → Target Sum including zeros → two-budget selection → partition into k buckets with an exponential state bound. Choose one chain, implement two transitions and explain why the remaining transitions are not merely renamings.
Practice queue
Use the restored L07, L27–L30, L36–L44 and L51–L56 lessons as answer references only after an unaided attempt. Retest the failed objective with a new instance after a delay. Keep timing, correctness and explanation quality as separate measurements.
Corrective source notes
- Improving Students’ Learning With Effective Learning Techniques: Promising Directions From Cognitive and Educational Psychology – Association for Psychological Science – APS — The reviewed learning-science summary rates practice testing and distributed practice highly, not a particular calendar or hiring score. Checked 2026-10-07.
These citations support the named claims, not blanket certification of the lesson. Worked proofs are derived in the text; execution scope and finite-test limits are recorded separately.
Pause / Recall / Apply
Can you explain it without the page?
Close the example. Reconstruct the core idea, then change one assumption. Mark complete when you’re ready; you can always undo it.
Stored in this browser only. No account, no sync. Clearing browser data removes your record.