Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 2392. Build a Matrix With Conditions
Place numbers 1..k into a k×k grid (one per cell) so that given pairs enforce which number must appear in a strictly higher row or strictly more leftward column; return any valid matrix or empty if impossible. The core challenge is checking for cycles and deriving compatible row and column orders (via topological sort) and then mapping numbers to positions.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.