NeetCode #654LC-2392HardAdvanced GraphsNC 250
← Back to All Problems#654 · #2392 · Build a Matrix With Conditions(给定条件下构造矩阵)
📌 Problem Statement & Constraints
You are given a positive integer
k, rowConditions where rowConditions[i] = [above, below] means the value above must be in a row strictly above below, and similarly colConditions. Return a k x k matrix containing 1..k satisfying both, or an empty matrix if impossible. Constraints: 2 <= k <= 400, 1 <= rowConditions.length, colConditions.length <= 10^4.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!