Let's solve the Most Stones Removed with Same Row or Column problem using the Union Find pattern.

Statement