Pyhton3 || Build a 2 row binary matrix
IntuitionApproachwe are given 3 things
upper - sum of upper row
lower - sum of lower row
cilsum- array of sum of ith column
Conclusions we can draw from it -
th
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->
we are given 3 things
1. upper - sum of upper row 
2. lower - sum of lower row 
3. cilsum- array of sum of ith column

Conclusions we can draw from it - 
1. there will always be 2 rows and n = len(colsum) will be the number of columns
2. if colsum[i] == 0 then both upper and lower row will be 0 
3. if colsum[i] == 1 then either upper or lower row will be 1
4. if colsum[i] == 2 then both upper and lower will be 1
5. if sum(colsum) != lower + upper it is not valid 

Results - 
1. we will have arrays seperate for both lower_row and upper_row 
2. for every row we will check and put 1's and 0's accordingly by keep subtracting from lower and upper as we put more 1's
3. by the end both lower and upper should be 0 if not then it is a not valid case

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def reconstructMatrix(self, upper: int, lower: int, colsum: List[int]) -> List[List[int]]:
        n = len(colsum)
        upper_row = [0]*n
        lower_row = [0]*n
        for i in range(n):
            if(colsum[i]==2):
                if(lower>0 and upper>0):
                    upper_row[i] = 1
                    lower_row[i] = 1
                    upper -=1
                    lower -=1
                else:
                    return []
            if(colsum[i]==1):
                if(upper>lower):
                    upper_row[i] = 1
                    upper -=1
                elif(lower>0):
                    lower_row[i] = 1
                    lower -=1
                else:
                    return []
        if(upper==0 and lower==0):
            return [upper_row, lower_row]
        else:
            return []

            
```
['Python3']