New
ML System Design & SQL tracks just landed
See what's new
×
Question Bank
Pricing
Blog
Forum
HOT
Referral
Description
Solution
Discussion
Submissions
Ask AI
Question Bank
Pinterest
Coding Question
AI Insights
Quick Summary
Model the pins and boards as a graph where any pins sharing a board are directly connected.
Check if pin1 and pin2 reside in the same connected component using BFS, DFS, or Union-Find.
Pre-build a hash map indexing each pin to its containing boards to enable efficient traversal.
What This Tests
Graph modeling and implicit graph construction
Connected components and reachability analysis
Hash-based indexing for fast neighbor lookup
Algorithmic trade-offs between traversal and disjoint set approaches
Common Patterns
Graph Traversal
BFS
Union Find
Hashing
Collapse
Hint 1
Hint 2
Hint 3
What Interviewers May Ask Next
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
Output
Expected