← All problemsSign in

2392. Build a Matrix With Conditions

LeetCodeArrayGraph TheoryTopological SortMatrixOpen on judge ↗

You are given a positive integer k. You are also given: - a 2D integer array rowConditions of size n where rowConditions[i] = [abovei, belowi], and - a 2D integer array colConditions of size m where colConditions[i] = [lefti, righti]. The two arrays contain integers from 1 to k. You have to build a k x k matrix that contains each of the numbers from 1 to k exactly once. The remaining cells sho

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start