Find number of redundant edges in components of a graph I’m trying to solve problem 1319 on Leetcode, which is as follows: