You are given a positive integer
A 2D integer array row_conditions of size row_conditions[i] = [above[i], below[i]]. This means that above[i] must appear in a row above below[i] in the final matrix.
A 2D integer array col_conditions of size col_conditions[i] = [left[i], right[i]]. This means that left[i] must appear in a column to the left of right[i] in the final matrix.
Both arrays contain integers from
Your task is to build a
The matrix should also satisfy the following conditions:
For each above[i] must appear in a row strictly above below[i].
For each left[i] must appear in a column strictly to the left of right[i].
Return any matrix that meets these conditions. If no valid matrix exists, return an empty matrix.
Constraints:
row_conditions.length, col_conditions.length
row_conditions[i].length col_conditions[i].length
above[i], below[i], left[i], right[i]
above[i] below[i]
left[i] right[i]
You are given a positive integer
A 2D integer array row_conditions of size row_conditions[i] = [above[i], below[i]]. This means that above[i] must appear in a row above below[i] in the final matrix.
A 2D integer array col_conditions of size col_conditions[i] = [left[i], right[i]]. This means that left[i] must appear in a column to the left of right[i] in the final matrix.
Both arrays contain integers from
Your task is to build a
The matrix should also satisfy the following conditions:
For each above[i] must appear in a row strictly above below[i].
For each left[i] must appear in a column strictly to the left of right[i].
Return any matrix that meets these conditions. If no valid matrix exists, return an empty matrix.
Constraints:
row_conditions.length, col_conditions.length
row_conditions[i].length col_conditions[i].length
above[i], below[i], left[i], right[i]
above[i] below[i]
left[i] right[i]