Simple Python Greedy O(n) Solution
Code\n\nclass Solution:\n    def reconstructMatrix(self, upper: int, lower: int, colsum: List[int]) -> List[List[int]]:\n        \n        n = len(colsum)\n    
# Code\n```\nclass Solution:\n    def reconstructMatrix(self, upper: int, lower: int, colsum: List[int]) -> List[List[int]]:\n        \n        n = len(colsum)\n        matrix = [[0] * n for _ in range(2)]\n        if upper + lower != sum(colsum): return []\n\n        for i in range(n):\n            if colsum[i] == 2:\n                matrix[0][i] = 1\n                matrix[1][i] = 1\n                upper -= 1\n                lower -= 1\n            elif colsum[i] == 1:\n                if lower <= upper:\n                    matrix[0][i] = 1\n                    upper -= 1\n                else:\n                    matrix[1][i] = 1\n                    lower -= 1\n        \n        if upper > 0 or lower > 0:\n            return []\n        \n        return matrix\n```
['Python3']