Code Room
CodingHardcod-g471
Subject Max flowLevel Senior–Staff~45 minCommon in Algorithms & data structures interviewsIndustries Software development, Technology

Question

Given a directed graph with n nodes (0..n-1) and edges [u, v, low, high] specifying that the flow on each edge must satisfy low <= f(u,v) <= high, determine whether a feasible circulation exists: an assignment of edge flows respecting every bound such that flow is conserved (in = out) at every node. Return True if feasible, else False. Lower bounds are non-negative integers with low <= high. Assume 1 <= n <= 200.

Implement
feasible_circulation(n: int, edges: list[list[int]]) → bool
Examples
in[3,[[0,1,1,3],[1,2,1,3],[2,0,1,3]]]outtrue
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.