HashSet or Array check redundant edges, why bother Union-Find


  • 0
    J

    In this problem, if one edge connects two visited points, then return this edge. Otherwise, set two points visited. Use array or hashset to track visited nodes.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.