Most Stones Removed With Same Row or Column
Medium
Disjoint Set (Union-Find)
Stones lie at distinct integer coordinates. A stone can be removed if another stone shares its row or column. Print the maximum number of stones that can be removed.
Constraints
1 <= n <= 1000 0 <= x, y <= 10^4
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.