The problem, in one line. Two walkers share a graph where some links only one of them can use and some both can. Remove as many links as possible while each walker can still reach every point, or return -1 if one already cannot. LeetCode 1579.
The tell. “Remove the most while everyone stays connected” means keep the fewest links, which is one spanning tree per walker. Each walker gets their own union-find, and a link is worth keeping only if it joins two groups for someone.