Product
Pricing
Blog
Forum
NEW
Referral
Description
Solution
Discussion
Submissions
Ask AI
AI Insights
Quick Summary
Calculate the minimum removals needed to clear all balls from a 2D plane.
Balls connect when sharing an axis and within a maximum distance threshold d.
Each removal clears a ball and its entire transitive connected group.
What This Tests
Graph connectivity and component identification
Disjoint Set Union (Union-Find) data structure application
Efficient spatial grouping and coordinate processing
Sorting and linear neighbor scanning
Common Patterns
Union Find
Sorting
Hashing
Collapse
Hint 1
Hint 2
What Interviewers May Ask Next
Report
Report seen similar question in interview
Accepted
1.5k
/2.8k
Acceptance Rate
54.4%
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
Python3
Auto
Debug
Run
Submit
Test Cases
Input
balls =
d =
Output
Expected