Simple Adjacent String Comparison Java Solution Using Set
Code\n\nclass Solution {\n    public int minDeletionSize(String[] strs) {\n        int cnt=0;\n        Set<Integer> compared=new HashSet<>();\n        for(int i
# Code\n```\nclass Solution {\n    public int minDeletionSize(String[] strs) {\n        int cnt=0;\n        Set<Integer> compared=new HashSet<>();\n        for(int i=0;i<strs[0].length();i++){\n            boolean f=true;\n            Set<Integer> currCompared=new HashSet<>();\n            for(int j=0;j<strs.length-1;j++){\n                if(!compared.contains(j)){   \n                    if(strs[j].charAt(i)>strs[j+1].charAt(i)){\n                        cnt++;\n                        f=false;\n                        break;\n                    }\n                    else if(strs[j].charAt(i)<strs[j+1].charAt(i))\n                        currCompared.add(j);\n                }\n            }\n            if(f)   compared.addAll(currCompared);\n        }\n        return cnt;\n    }\n}\n```
['Java']