awesome-everything RU
↑ Back to the climb

Algorithms from zero

Graphs: interview drill

Crux Timed graph-traversal and shortest-path problems from the NeetCode-150, with progressive hints — solve each cold, then narrate the complexity.
Your altitude — climbing toward senior
ZeroJuniorMiddleSenior
You are at senior altitude — in orbit
◷ 120 min

You understand DFS, BFS, and shortest paths. Interviews test whether you can recognise a grid or a prerequisite list as a graph in disguise, pick the right traversal under a timer, and explain the cost out loud.

Goal

Solve each problem before you reveal a hint, hit the target time, and narrate the time and space complexity as if an interviewer were listening. The hints exist for when you are genuinely stuck — they nudge you toward the pattern, never the full solution.

Five NeetCode-150 problems on the graph traversal and advanced-graph patterns this unit teaches. Set a timer, solve each cold without looking at a hint, then say the time and space complexity out loud before you move on. Reveal a hint only when you are truly stuck — the hints nudge, they never hand you the answer.

0/5 solved

graphs

#200 Number of IslandsMedium15m
AmazonMeta
Follow-up (aloud)

State the time complexity in terms of rows and columns. Why is each cell touched a constant number of times despite the nested traversal?

#133 Clone GraphMedium15m
MetaAmazon
Follow-up (aloud)

Why does the visited map serve double duty as both the cycle guard and the result? What is the space complexity?

#207 Course ScheduleMedium20m
AmazonGoogle
Follow-up (aloud)

Contrast DFS cycle detection with Kahn's algorithm: what state does each track, and how does each conclude a cycle exists?

#417 Pacific Atlantic Water FlowMedium20m
AmazonGoogle
Follow-up (aloud)

Why is flooding inward from the oceans asymptotically cheaper than flooding outward from every cell? Give both complexities.

advanced graphs

#743 Network Delay TimeMedium20m
AmazonGoogle
Follow-up (aloud)

State Dijkstra's complexity with a binary heap. Why does it require non-negative edge weights, and what would you reach for if some were negative?

Recap

Mark each problem solved once you finished it cold, inside the target time, and could state the complexity without hesitation. Come back in a few days and re-solve the ones you marked — spaced revisits are what turn a recognised pattern into a reflex.

Continue the climb ↑What is dynamic programming?
shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources2
expand
  1. 01
  2. 02

Trademarks belong to their respective owners. Editorial reference only.