✅💯🔥Explanations No One Will Give You🎓🧠Very Detailed Approach🎯🔥Extremely Simple And Effective🔥
Complexity\n- Time complexity:\n Add your time complexity here, e.g. O(n) \n    O(N*2)\n\n- Space complexity:\n Add your space complexity here, e.g. O(n) \n    
# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n    O(N*2)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n    O(1)\n\n# Code\n```\nclass Solution {\npublic:\n    vector<vector<int>> reconstructMatrix(int u, int l, vector<int>& c) {\n        vector<vector<int>>ans(2,vector<int>(c.size(),0));\n        int n=c.size();\n\n        int sum=0;\n        for(int i:c) sum+=i;\n        if((u+l) != sum) return {};\n\n        for(int i=0;i<n;i++){\n            if(c[i]==0) continue;\n\n            else if(c[i]==2){\n                ans[0][i]=1;\n                ans[1][i]=1;\n                u--;\n                l--;\n            }\n        }\n        if(u<0 or l<0) return {};\n        for(int i=0;i<n;i++){\n            if(c[i]==1){\n                if(u){\n                    u--;\n                    ans[0][i]=1;\n                }\n                else{\n                    l--;\n                    ans[1][i]=1;\n                }\n            }\n        }\n\n\n        return ans;\n    }\n};\n```
['Array', 'Greedy', 'Matrix', 'C++']