Product
Pricing
Blog
Forum
NEW
Referral
Description
Solution
Discussion
Submissions
Ask AI
AI Insights
Quick Summary
Recommend one non-friend per user based on shared connections.
Rank candidates by mutual friend count.
Use smallest index for ties and return -1 when no valid options exist.
What This Tests
Graph representation and neighbor exploration
Set intersection for counting shared elements
Constraint-driven algorithmic optimization
Tie-breaking and edge case management
Common Patterns
Hashing
Graph Traversal
Sorting
Collapse
Hint 1
Hint 2
What Interviewers May Ask Next
Report
Report seen similar question in interview
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
python
Auto
Debug
Run
Submit
Test Cases
Input
Output
Expected