Search
⌘K

Leetcode 1253. Reconstruct a 2-Row Binary Matrix

Reconstruct a 2×n binary matrix whose column sums equal the given colsum array and whose top and bottom row sums equal upper and lower respectively, returning any valid matrix or an empty array if impossible. The core challenge is a feasibility/assignment problem over columns with colsum values 0,1,2 (where 2 forces a 1 in both rows and 1s must be distributed to meet the row totals).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.