Easy | Greedy
Intuition\nStarting from the 0th position if we compare consecutive strings (i with i+1) their 0th character then 3 cases can happen - greater, smaller or equal
# Intuition\nStarting from the 0th position if we compare consecutive strings (i with i+1) their 0th character then 3 cases can happen - greater, smaller or equal for their 0th character.\nThis means for some elements we can for the smaller cases we can for sure say that they satisfy lexico criteria and those with the bigger cases can never satisfy so we have to delete this index.\nNow coming to the equal case, so we can\'t comment on this now. We have to see the further indices going by length.\n\nSo, what we will do is we will maintain a boolean array for the elements of the given string array and update that whether this element is satisfying the lexico criteria with its consecutive or not. If it is already satisfying then we don\'t have to check this element for its next indices by length and if it is not satisying then delete this index, and if it is satisying now but not was previously then update your boolean array.\nAnd if equality is there then just skip this as it is undecided state now.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\nO(N*len(strs[0]))\n- Space complexity:\nO(N)\n# Code\n```\nclass Solution {\npublic:\n    int minDeletionSize(vector<string>& strs) \n    {\n        int ans = 0, len = strs[0].length(), n = strs.size();\n        vector<bool> isdone(n, 0);\n\n        for(int i = 0; i < len; i++)\n        {\n            vector<bool> temp(n, 0);\n            bool flag = 0;\n            for(int j = 0; j < n-1; j++)\n            {\n                if(isdone[j] == 0)\n                {\n                    if(strs[j][i] > strs[j+1][i])\n                    {\n                        ans++;\n                        flag = 1;\n                        break;\n                    }\n                    else if(strs[j][i] < strs[j+1][i])\n                    {\n                        temp[j] = 1;\n                    }\n                }\n            }\n\n            if(!flag)\n            {\n                for(int j = 0; j < n-1; j++)\n                {\n                    isdone[j] = (isdone[j] || temp[j]);\n                }\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']