Interview Cheat Sheet
Quick reference for product-focused frontend interviews (e.g. 45-minute live coding). Focus on clarity, correctness, and calm reasoning over cleverness.
1) Core patterns (most questions)
Tree / nested data
Components, folders, JSON. Classic DFS.
function dfs(node) {
visit(node)
for (const child of node.children ?? []) {
dfs(child)
}
}Time: O(n) — visit each node once. Space: O(h) stack + O(k) output.
Sliding window
Strings, tokens, event streams.
while (right < n) {
add(right)
while (valid()) {
updateAnswer()
remove(left)
left++
}
right++
}Time: O(n). Space: O(k) (distinct required items).
Hash maps / frequency counts
map[key] = (map[key] ?? 0) + 1Time: O(n). Space: O(u) (unique keys).
Intervals / ranges
Sort by start, then sweep and merge.
Time: O(n log n). Space: O(n).
2) String problems — key distinctions
- Literal substring → indexOf / simple scan
- Any permutation → sliding window + counts
- Min window containing → expand right, shrink left
- Words instead of chars → tokenize, same window logic
3) Tokenization + normalization (product FE)
- Tokenize original text first
- Store raw, normalized, start, end per token
- Match on normalized, slice original using indices
Normalization cost: O(T) total characters.
4) TypeScript live-coding tips
- Prefer
for…ofoverreduceunder pressure - Use
Record<string, number>for counts - Guard optional fields:
children ?? [] - Early returns for edge cases
- Readable > clever
5) Interview pacing (45 minutes)
- 0–5 min: clarify + examples
- 5–10 min: approach + complexity
- 10–30 min: code correct solution
- 30–40 min: edge cases + cleanup
- 40–45 min: tradeoffs / alternatives
Say early: “I’ll start with a straightforward solution and optimize if needed.”
6) End-of-interview questions
- What kinds of problems does this role solve most often?
- How do frontend and platform teams collaborate?
- What does success look like in the first 90 days?