Solution: Build a Matrix with Conditions
Let’s solve the Build a Matrix with Conditions problem using the Topological Sort pattern.
We'll cover the following...
We'll cover the following...
Statement
You are given a positive integer 
- A 2D integer array - rowConditionsof size- , where - rowConditions[i] = [above[i], below[i]]. This indicates that- above[i]must appear in a row above- below[i]in the final matrix.
- A 2D integer array - colConditionsof size- , where - colConditions[i] = [left[i], right[i]]. This indicates that- left[i]must appear in a column to the left of- right[i]in the final matrix.
Both arrays contain integers ranging from 
You need to construct a