Code Room
CodingHard
Question
A directed flow network has n nodes (0..n-1). edges is a list of [u, v, c] meaning a directed pipe from u to v with capacity c. Return the maximum flow value from source s to sink t. Multiple edges between the same pair may appear and must each contribute. Constraints: 1 <= n <= 300; 0 <= c <= 10^6.
Implement
max_flow(n: int, edges: list[list[int]], s: int, t: int) → intExamples
in
[6,[[0,1,10],[0,2,10],[1,3,4],[1,4,8],[2,4,9],[3,5,10],[4,3,6],[4,5,10]],0,5]out19What 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.
Learn the concepts
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.