Java Tech Enthusiast
Java Tech Enthusiast
Jan 31, 2026 · Interview Experience

How to Remove the Most Edges While Keeping a Graph Fully Traversable for Alice and Bob

Given an undirected graph with three edge types—Alice‑only, Bob‑only, and shared—the task is to delete the maximum number of edges while still allowing both Alice and Bob to reach every node; the solution uses a two‑union‑find strategy, processes shared edges first, then exclusive ones, and returns the count or -1.

LeetCodealgorithmedge removal
0 likes · 9 min read
How to Remove the Most Edges While Keeping a Graph Fully Traversable for Alice and Bob
IT Services Circle
IT Services Circle
Mar 2, 2022 · Fundamentals

Union-Find Solution for Determining Friend Circles (Alibaba Interview Question)

This article explains an Alibaba interview problem about counting friend circles using the union‑find (disjoint set) data structure, provides a detailed conceptual analysis, visual illustrations, and a complete C++ implementation that determines whether two people belong to the same circle and computes the total number of distinct circles.

C++Friend Circledisjoint-set
0 likes · 6 min read
Union-Find Solution for Determining Friend Circles (Alibaba Interview Question)