Mock technical interviews with an AI interviewer.
Every problem leaves something out. Ask about it before you code.
Problems
- Cheapest Network From a Start ServerA network grows from a start server. There are n servers numbered 0 to n - 1 and a list of cables that could be laid, each [u, v, cost]. Each step, the network lays the cheapest cable that brings in a server it does not have yet. Return the servers in the order they join, starting with the start server.MediumGraph algorithmsGraph algorithms
- Cheapest Roads to Connect Every TownThere are n towns numbered 0 to n - 1 and a list of roads that could be built, each [u, v, cost], working both ways once built. Return the smallest total cost of roads to build so that every town can reach every other.MediumGraph algorithmsGraph algorithms
- Does the Graph Have a CycleA graph has n nodes numbered 0 to n - 1 and a list of connections, each joining two nodes both ways. Return whether the graph has a cycle: a way to leave a node and come back to it without using any connection twice.MediumGraph algorithmsGraph algorithms
- Order the TasksThere are n tasks numbered 0 to n - 1 and a list of rules [a, b], each meaning task a must be done before task b. Return an order in which to do all the tasks that keeps every rule.MediumGraph algorithmsGraph algorithms
- Shortest Distances From a SourceA graph has n nodes numbered 0 to n - 1 and a list of edges [u, v, w], each with a cost w of at least 0. Return the cheapest total cost from the source to every node, or -1 for a node the source cannot reach.MediumGraph algorithmsGraph algorithms
- Shortest Distances With Negative EdgesA graph has n nodes and a list of edges [u, v, w], where a cost w can be negative. Return the cheapest total cost from the source to every node, or an empty list if a cycle of negative total cost makes costs keep falling forever.HardGraph algorithmsGraph algorithms