Topic
Trees & Graphs interview problems
Traversals, shortest paths, topological order and union-find. 434 original problems, each with hidden test cases you can run in the browser.
25 easy362 medium47 hard
Showing 421–434 of 434 results
Tests whether you can model dependency constraints as a directed graph and use topological sort to detect cycles that make all tasks impossible to complete.
Auto-gradedtopological-sortgraphcycle-detectionGiven exchange rates between currencies and a per-cycle transaction cost, determine if any sequence of trades can yield a profit.
Model answergraph-algorithmsbellman-fordnegative-cyclelogarithmsTests recursive tree traversal with order-sensitive child pairing by name occurrence and careful handling of unmatched nodes.
Auto-gradedrecursiontree-traversalhash-tableTests graph traversal and connected-component identification on a 2D grid using flood-fill techniques.
Auto-gradedgraph-traversaldfsconnected-componentsgridTests cycle detection in a directed graph by determining which packages in a build dependency graph are part of a circular dependency chain.
Auto-gradedgraphscycle detectionDFStopological sortTests whether a candidate can apply topological ordering (Kahn's algorithm / BFS layer-by-layer) to schedule tasks into the fewest sequential build phases.
Auto-gradedgraphstopological sortBFSDAGTests Kahn's algorithm with deterministic tie-breaking, urgency-based heap ordering, cycle detection with path reporting, and transparent skipping of tag-excluded tasks.
Auto-gradedtopological-sortheapgraphsTests depth-first (or breadth-first) traversal of a binary tree while tracking the accumulated digit value along each root-to-leaf path.
Auto-gradedbinary-treebfsdfsTests whether candidates can apply topological sort (Kahn's algorithm or DFS) to determine a valid linear build order from a dependency graph of software patches.
Auto-gradedgraphstopological sortBFSKahn's algorithmTests topological ordering (Kahn's algorithm / BFS layering) to schedule dependent courses into the fewest sequential batches where each batch runs in parallel.
Auto-gradedgraphstopological-sortBFSTests tree DP by finding the maximum sum of node values when no two selected nodes may be adjacent (parent-child) in a rooted tree.
Auto-gradedtreedynamic programmingrecursionTests BFS shortest-path reasoning on a grid by finding the minimum steps to collect all treasure chests from a starting position, visiting each chest at least once.
Auto-gradedgraphsBFSgridshortest pathTests the ability to apply Dijkstra's algorithm augmented with a constraint dimension (fuel stops used) to find the minimum-time path in a weighted graph.
Auto-gradedgraphsdijkstrashortest pathdynamic programmingTests BFS shortest-path reasoning on a grid with time-dependent obstacles, requiring candidates to track fire spread and find the minimum escape steps simultaneously.
Auto-gradedbfsgridshortest pathmulti-source bfs