Python O(n) greedy solution
Intuition
Build the 2d matrix with two rows and try to fill out, the main cases are:
If column ith is 2 then both cols need to be 1, if zero just skip it, if 1
# Intuition
- Build the 2d matrix with two rows and try to fill out, the main cases are:
- If column ith is 2 then both cols need to be 1, if zero just skip it, if 1 then the 1 needs to be on either row (choose the one with expected larger sum greedy)
- Check mid iteration if any of the contions have been violated, i.e., any of the rows is greater than expected. 
- Check in the final iteration if the sum has been reached

# Approach
<!-- Describe your approach to solving the problem. -->

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

- Space complexity: O(n)
<!-- 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]]:
        mat = [[0] * len(colsum) for _ in range(2)]
        if not upper and not lower:
            return mat
        rows_max = [upper, lower]
        rows_sum = [0, 0]
        for j in range(len(colsum)):
            csum = colsum[j]
            if csum == 2:
                mat[0][j] = 1
                mat[1][j] = 1
                rows_sum[0] += 1
                rows_sum[1] += 1
            elif csum == 1:
                if rows_max[0] >= rows_max[1]:
                    mat[0][j] = 1
                    rows_sum[0] += 1
                    rows_max[0] -= 1
                else:
                    mat[1][j] = 1
                    rows_sum[1] += 1
                    rows_max[1] -= 1
            if rows_sum[0] > upper:
                return []
            if rows_sum[1] > lower:
                return []
        if rows_sum[0] < upper or rows_sum[1] < lower:
            return []
        return mat
```
['Python3']