• + 0 comments

    Java 15

    public static int gemstones(List<String> arr) {
        // Write your code here
        int count=0; 
        String alphabet = "abcdefghijklmnopqrstuvwxyz";
        for (int i = 0; i < alphabet.length(); i++) {
            boolean flag = true;
            for (String str : arr) {
                if(!str.contains(String.valueOf(alphabet.charAt(i)))){
                    flag = false;
                }
            }
            if (flag) {
                count++;
            }
        }
        
        return count;
    
        }