Question
A connected undirected graph that started as a tree on n nodes (labeled 1..n) had exactly one extra edge added, creating exactly one cycle. You are given the n edges as [u, v] in the order they were added. Return the one edge that can be removed so the result is a tree; if multiple answers, return the edge that appears last in the input. Nodes are 1-indexed.
redundant_edge(edges: list[list[int]]) → list[int][[[1,2],[1,3],[2,3]]]out[2,3]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.