Question
Given a directed multigraph with n nodes (0..n-1) and a list of directed edges (parallel edges allowed), reconstruct an Eulerian circuit: a closed walk that uses every edge exactly once and returns to its start. Return the sequence of visited nodes (length = #edges + 1); if no Eulerian circuit exists return an empty list. To make the output deterministic, when leaving a node always take the unused outgoing edge to the smallest-numbered neighbor first. For an empty edge list return []. Assume 1 <= n <= 2000.
eulerian_circuit(n: int, edges: list[list[int]]) → list[int][3,[[0,1],[1,2],[2,0]]]out[0,1,2,0]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.