Java solution | Clean Code
Complexity\nLet n = strs.length\nm = strs[0].length\n- Time complexity: $O(m * n)$\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: $O(n)$\n A
# Complexity\nLet n = strs.length\nm = strs[0].length\n- Time complexity: $O(m * n)$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $O(n)$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java\nclass Solution {\n    public int minDeletionSize(String[] strs) {\n        int n = strs.length;\n        int m = strs[0].length();\n        int cnt = 0;\n        // flag[i] = true if strs[i][j] > strs[i - 1][j] else false ; j = column index\n        boolean flag[] = new boolean[n];\n        for(int i = 0;i < m;i++){\n            boolean delCol = false;\n            for(int j = 1;j < n;j++){\n                if(flag[j]) continue;\n                if(strs[j].charAt(i) < strs[j - 1].charAt(i)){\n                    ++cnt;\n                    delCol = true;\n                    break;\n                }\n            }\n            if(!delCol){\n                for(int j = 1;j < n;j++){\n                    if(!flag[j] && strs[j].charAt(i) > strs[j - 1].charAt(i)){\n                        flag[j] = true;\n                    }\n                }\n            }\n        }\n        return cnt;\n    }\n}\n```
['Java']