python fast (100%) memory (100%) solution (19.Nov.09)
\nclass Solution:\n    def reconstructMatrix(self, upper: int, lower: int, colsum: List[int]) -> List[List[int]]:\n        \n        matrix = [[ 0 for i in rang
```\nclass Solution:\n    def reconstructMatrix(self, upper: int, lower: int, colsum: List[int]) -> List[List[int]]:\n        \n        matrix = [[ 0 for i in range(len(colsum))] for j in range(2)]\n        \n        matsum = sum(colsum)\n        \n        if matsum != upper+lower:\n            return []\n        \n        colsum_counter = {}\n        for i in range(3):\n            colsum_counter[i] = 0\n        \n        for i in colsum:\n            colsum_counter[i] +=1\n        \n        upper_counter = upper - colsum_counter[2]\n        lower_counter = lower - colsum_counter[2]\n        \n        \n        for col in range(len(colsum)):\n            if colsum[col] == 2:\n                matrix[0][col]=1\n                matrix[1][col]=1\n            elif colsum[col] ==0:\n                continue\n            else:\n                if upper_counter>0:\n                    matrix[0][col]=1\n                    matrix[1][col]=0\n                    upper_counter-=1\n                else:\n                    matrix[0][col]=0\n                    matrix[1][col]=1\n                    lower_counter -=1\n        if lower_counter != 0:\n            return []\n                    \n        return matrix\n```
[]