Easy cpp
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    vector<vector<int>> reconstructMatrix(int upper, int lower, vector<int>& colsum) {\n        \n        vector<vector<int>>ans(2,vector<int>(colsum.size(),0));\n\n            for(int i=0;i<colsum.size();i++)\n             {\n                 if(colsum[i]==1)\n                 {\n                    if(upper>lower)\n                    {\n                        ans[0][i]=1;\n                        upper--;\n                    }\n                    else\n                    {\n                        ans[1][i] =1;\n                        lower--;\n                    }\n                 }\n\n                 if(colsum[i]==2)\n                 {\n                    ans[0][i]=1;\n                    ans[1][i] =1;\n\n                    lower--;\n                    upper--;\n                 }\n\n\n                 // chceck invalid cases\n\n                  if(upper<0 && lower<0)\n                  {\n                    return {};\n                  }\n             }\n\n              if(upper!=0 or lower!=0)  \n            return {};\n        \n        return ans;\n\n\n    }\n};\n```
['C++']