greedy approach
\nclass Solution:\n    def reconstructMatrix(self, upper: int, lower: int, colsum: List[int]) -> List[List[int]]:\n        if (upper+lower)!=sum(colsum):\n     
```\nclass Solution:\n    def reconstructMatrix(self, upper: int, lower: int, colsum: List[int]) -> List[List[int]]:\n        if (upper+lower)!=sum(colsum):\n            return []\n        \n        res=[[0 for i in range(len(colsum))] for j in range(2)]\n        \n        for i in range(len(colsum)):\n            if colsum[i]==2:\n                if upper>0 and lower>0:\n                    lower-=1\n                    upper-=1\n                    res[0][i]=1\n                    res[1][i]=1\n                else:\n                    return []\n        for i in range(len(colsum)):\n            \n            if colsum[i]==1:\n                \n                if upper>0:\n                    res[0][i]=1\n                    upper-=1\n                elif lower>0:\n                    res[1][i]=1\n                    lower-=1\n                else:\n                    return []\n        return res\n```
['Greedy', 'Python']