Product
Pricing
Blog
Forum
NEW
Referral
Description
Solution
Discussion
Submissions
Ask AI
AI Insights
Quick Summary
Color all empty cells black or white so adjacent cells never share the same color.
Boundary cells act as walls that partition the grid into independent regions.
Return true if a valid coloring exists that respects all pre-colored cells and adjacency rules.
What This Tests
Graph traversal on 2D matrices
Bipartite graph verification
Component isolation and local constraint satisfaction
Flexible constraint mapping per connected component
Common Patterns
BFS
Graph Traversal
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