Leetcode 1489: Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree

In this Leetcode problem, given a graph, we want to find which edges are in all minimum spanning trees, and which ones are only in some minimum spanning trees.

Problem statement

This is a cool problem and there are a lot of ways you can think about it, here are the ideas I used to solve it: