...

/

Solution: Build a Matrix with Conditions

Solution: Build a Matrix with Conditions

Let’s solve the Build a Matrix with Conditions problem using the Topological Sort pattern.

Statement

You are given a positive integer kk and two conditions:

  • A 2D integer array rowConditions of size nn, 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 colConditions of size m ...

Access this course and 1400+ top-rated courses and projects.