Mock 05 — Big Tech Phone Screen

Interview type: FAANG-style phone screen (Google, Meta, Amazon, Microsoft, Apple) Target role: SWE-II / Senior phone round Time limit: 45 minutes total Format: ~5 min intro + 35 min coding + 5 min Q&A. ONE medium-to-hard problem with strong follow-ups. Hints policy: Hints cost real points at FAANG — one is acceptable, two is borderline, three fails. Primary goal: Show you can work cleanly under FAANG’s exact format.


What This Mock Tests

This mock simulates the actual FAANG phone screen format. The interviewer:

  • Greets you (~3 min)
  • Asks one 1-min behavioral warm-up (“What are you excited about lately?”)
  • Presents the coding problem
  • Expects you to clarify, plan, code, test
  • Asks 2–3 follow-up extensions in the remaining time

The signal they’re collecting: can this person work on our team without supervision? Specifically — do they understand requirements, optimize without being told to, write reasonable code, and engage with extensions intelligently?

Scoring weights: Problem Understanding, Optimization, Communication, Follow-ups are all critical (3+). One weak dimension = no advance.


Pick One Problem

Problem A — Longest Increasing Path in a Matrix (LC 329)

Given an m × n integer matrix, return the length of the longest strictly increasing path. From a cell, you may move up/down/left/right (no diagonals, no wraparound).

Examples:

[[9,9,4],[6,6,8],[2,1,1]]   → 4   (path 1→2→6→9)
[[3,4,5],[3,2,6],[2,2,1]]   → 4   (path 3→4→5→6)
[[1]]                         → 1

Constraints: 1 ≤ m, n ≤ 200. 0 ≤ matrix[i][j] ≤ 2^31 - 1.

Problem B — Word Ladder (LC 127)

Given two words beginWord and endWord and a dictionary wordList, find the length of the shortest transformation sequence (each step changes exactly one letter; intermediate words must be in dictionary). Return 0 if no sequence exists.

Examples:

"hit", "cog", ["hot","dot","dog","lot","log","cog"]   → 5  (hit→hot→dot→dog→cog)
"hit", "cog", ["hot","dot","dog","lot","log"]          → 0  (cog not in dict)

Constraints: 1 ≤ |beginWord| ≤ 10. All words same length, lowercase. 1 ≤ |wordList| ≤ 5000.

Problem C — Number of Islands (LC 200)

Given a 2D grid of '1' (land) and '0' (water), count the number of islands (connected groups of land, 4-directional).

Examples:

[
 ["1","1","1","1","0"],
 ["1","1","0","1","0"],
 ["1","1","0","0","0"],
 ["0","0","0","0","0"]
] → 1

[
 ["1","1","0","0","0"],
 ["1","1","0","0","0"],
 ["0","0","1","0","0"],
 ["0","0","0","1","1"]
] → 3

Constraints: 1 ≤ m, n ≤ 300.


Expected Communication Style

  1. Restate and confirm types. (“Integer matrix; I return the length of the longest strictly increasing path; movement is 4-directional.”)
  2. Ask 3–5 clarifying questions: matrix size, value range, strictly vs non-strictly increasing, do diagonals count.
  3. State brute force with complexity. (“DFS from every cell, no memo, exponential worst case.”)
  4. Identify the optimization signal. (“DFS + memoization since subpath answers don’t change. Or topological sort on the DAG of (i,j) → (i’, j’) where val(i,j) < val(i’, j’).”)
  5. Justify your choice between alternatives. (“Memo’d DFS is simpler; topo sort is more rigorous and avoids stack depth issues at 200×200.”)
  6. Code cleanly. Helper functions, no inline magic.
  7. Walk through the example. Test 2+ edge cases.
  8. Engage with the follow-ups — these decide the round.

Solution Sketches

A. Longest Increasing Path: memoized DFS. dp[i][j] = longest path starting at (i, j). Recurse to 4 neighbors with strictly greater value; dp[i][j] = 1 + max(dp[neighbor]). O(mn) time and space. The DAG structure ((i,j) → (i', j') iff val < val') guarantees no cycles, so memo is sound.

B. Word Ladder: BFS over the graph where nodes are words and edges connect words differing by one letter. Use a “wildcard bucket” optimization: for each word, generate patterns like h*t, *ot, ho*; bucket words by pattern; neighbors are words sharing a pattern bucket. O(N · L²) where N = dict size, L = word length.

C. Number of Islands: for each unvisited ‘1’, flood fill (BFS or DFS), mark visited, increment count. O(mn) time and space.


Common Failure Modes

  1. A: brute force without memo. TLE on 50×50.
  2. A: incorrect strict vs non-strict check. > vs >= flips the answer.
  3. B: built a graph by comparing every pair of words. O(N² · L) — too slow for N = 5000.
  4. B: didn’t notice endWord may not be in dict. Returns wrong if you assume it is.
  5. B: BFS without visited tracking. Infinite loop.
  6. C: modified input grid without permission. Some interviewers care; clarify first.
  7. All: weak follow-up answers. “I’d just use a database” — too vague; doesn’t show understanding.

Passing Bar

  • Total score: 46/70 (average 3.3)
  • Optimal complexity reached
  • Correctness on given examples + 2 edge cases
  • Hint usage ≤ 1
  • Time ≤ 45 min
  • Two follow-ups answered with substance

Follow-up Questions

For A:

  • Return the path itself, not just the length. → Add parent pointer in DP; reconstruct.
  • What if path can revisit cells? → No longer a DAG; problem is NP-hard (Hamiltonian-flavored).
  • Path with diagonal moves allowed? → 8 neighbors instead of 4; same algorithm.
  • Matrix is sparse (mostly 0). → Algorithm doesn’t change asymptotically; data layout (CSR) matters at scale.
  • Matrix doesn’t fit in memory. → Chunked processing with overlap; harder boundary handling.

For B:

  • Return one valid path. → Track BFS parent; reconstruct.
  • Return ALL shortest paths (Word Ladder II, LC 126). → BFS to build the DAG, then DFS to enumerate.
  • Bidirectional BFS for speedup. → Search from both ends, meet in middle. Roughly √ improvement.
  • Streaming dictionary (words arriving). → Re-bucket on each insert; same algorithm.

For C:

  • Count distinct island shapes. → Canonicalize the shape (sort relative cell positions, possibly rotate/reflect); hash.
  • Number of islands II (online — cells added one by one). → Union-Find; O(α(N)) per operation.
  • Largest island after flipping at most one ‘0’ to ‘1’. → Label each island with size; for each ‘0’, sum sizes of unique neighboring islands + 1.
  • 3D islands. → Same algorithm, 6 neighbors instead of 4.

Required Tests

  • All given examples
  • 1×1 matrix / single-letter input
  • All-same-value matrix (A: answer is 1)
  • Disconnected components (C: multiple islands)
  • Long diagonal-like path (A)
  • Dictionary missing the endWord (B)
  • Empty grid / empty dictionary edge

Required Complexity Explanation

  • Time, with reasoning
  • Space, including recursion stack and memoization tables
  • Worst-case input that triggers the worst-case complexity
  • For A: explain why memo turns O(4^(mn)) into O(mn)

Self-Evaluation Template

Mock 05 — Big Tech Phone Screen
Date: _______
Problem: _______
Time: ___ / 45 min
Hints used: ___
Follow-ups answered well (out of 2 asked): ___

Scores (1–5):
___ Total /70

Did I narrate continuously? Y/N
Did I identify the optimization signal before coding? Y/N
Did I test 2+ unprompted edges? Y/N

What I would change for the real interview:

What to Do If You Fail

  • Score 40–45: Re-do with a different problem; pinpoint weak dimension.
  • Score <40: You’re not ready for FAANG phone screens. Do 10 more mediums + 3 hards, then retry.
  • Optimization gap: Phase 2 patterns + Phase 4 graphs are the most-tested patterns at FAANG.
  • Follow-up weakness: This is the #1 thing that distinguishes “hire” from “no-hire” at FAANG phone screens. Treat follow-ups as a primary skill, not an afterthought.
  • Pass twice in a row before moving to Mock 06.