New
ML System Design & SQL tracks just landed
See what's new
×
Question Bank
Pricing
Blog
Forum
HOT
JobRadar
NEW
Referral
Description
Solution
Discussion
Submissions
Ask AI
Question Bank
Waymo
Coding Question
AI Insights
Quick Summary
Identify all connected land components in a 2D binary grid.
Calculate both the total land cells and distinct adjacent water cells for each component.
Return a collection of [area, boundary_count] pairs without caring about order.
What This Tests
Grid-based graph traversal
Connected component analysis
State tracking and cycle prevention
Using hash sets for unique element counting
Common Patterns
DFS/BFS
Graph Traversal
Hashing
Collapse
Hint 1
Hint 2
What Interviewers May Ask Next
Accepted
2.3k
/4.5k
Acceptance Rate
51.2%
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
Qwen
Qwen3.6-Flash
0/2000
Auto
Debug
Run
Submit
Test Cases
Input
grid =
Output
Expected