Detailed Explanation using Greedy Approach
Intuition\n* First, intialize both the rows as 0. Now, fill the indices where the vertical column sum is 2 (as they don\'t have a choice). So, now we only need 
# Intuition\n* First, intialize both the rows as `0`. Now, fill the indices where the vertical column sum is `2` (as they don\'t have a choice). So, now we only need to make choices for the columns with sum `1`. Find out the current sum of the first row. Compare it with the required amount. If the difference becomes negative, it means that there is no solution. Else, greedily fill the required `1s` in the top row and the remaining `1s` in the bottom row. Finally, check if the sum of the bottom row equals `lower`\n\n```cpp\nclass Solution\n{\npublic:\n    vector<vector<int>> reconstructMatrix(int upper, int lower, vector<int>& colsum);\n};\n\nvector<vector<int>> Solution :: reconstructMatrix(int upper, int lower, vector<int>& colsum)\n{\n    int n = colsum.size();\n    vector<vector<int>> mat(2, vector<int> (n, 0));\n    \n    for(int i = 0; i < n; i++)\n        if(colsum[i] == 2)\n            mat[0][i] = 1, mat[1][i] = 1;\n    \n    auto& first_row = mat[0];\n    int current_upper_sum = accumulate(first_row.begin(), first_row.end(), 0);\n    \n    int diff = upper - current_upper_sum;\n    \n    if(diff < 0)\n        return vector<vector<int>>();\n    \n    for(int i = 0; i < n; i++)\n    {\n        if(colsum[i] == 1)\n        {\n            if(diff > 0)\n                mat[0][i] = 1, diff--;\n            else \n                mat[1][i] = 1;\n        }\n    }\n    \n    auto& second_row = mat[1];\n    int current_lower_sum = accumulate(second_row.begin(), second_row.end(), 0);\n    \n    if(current_lower_sum != lower)\n        return vector<vector<int>> ();\n    \n    return mat;\n        \n}\n```
[]