Java Solution 6ms beats 100%
// O(m * n), m = string length, n = array size\n\n// (1) only need to compare ajacent strings \n// (2) have a rank[] to record the rank of previous characters i
// O(m * n), m = string length, n = array size\n\n// (1) only need to compare ajacent strings \n// (2) have a rank[] to record the rank of previous characters in a string. if there is rank already, there is no need to compare again.  \nrank[i] = true means rank of A[i] is higher than the rank of A[i-1]\n// (3) if the column is not deleted, we will update the rank[].\n// (4). if not in order is found, need to delete the column\n/* Example\nInput: ["aba","gbf","dcd"]\n\ncol:  012    when col = 1\n0     aba    rank[0] = false\n1     gbf    rank[1] = false\n2     dcd    rank[2] = true\n\nwhen col = 0, we find we need to delete this column\nwhen col = 1, all characters in this column are in order, so this column don\'t need to be deleted. But we need to update the rank[]. \n\n*/\n\n```\nclass Solution {\n\n    boolean[] rank;\n    public int minDeletionSize(String[] A) {\n        int n = A[0].length();\n        rank = new boolean[A.length];\n        int res = 0;\n        // from first character to last character\n        for (int col = 0; col < n; col++) {\n            boolean delCol = false;\n            // compare ajacent string only\n            for (int i = 1; i < A.length; i++) {\n                if (rank[i]) continue; // meaning A[i] > A[i - 1] in rank\n                if (A[i - 1].charAt(col) > A[i].charAt(col)) { // not in order, need to delete the column\n                    res++;\n                    // System.out.println("col: " + col + " A[i]: " + A[i]);\n                    delCol = true;\n                    break;\n                }\n            }\n            if (!delCol) { // if the column is not deleted, update rank[]\n                for (int i = 1; i < A.length; i++) {\n                    if (!rank[i] && A[i].charAt(col) > A[i - 1].charAt(col)) {\n                        rank[i] = true;\n                    }\n                }\n            }\n\n        }\n        \n        return res;\n    }\n\n}\n```
[]