You are viewing a single comment's thread. Return to all comments →
public class Solution {
static int gemstones(String[] arr){ String[] array ={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","y","x","z"}; int count1 =0; int count2 =0; for(int i=0;i<array.length;i++) { count1=0; for(int j=0;j<arr.length;j++) { if(arr[j].contains(array[i])) { count1++; } if(count1==arr.length){ count2++; } } } return count2; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String[] arr = new String[n]; for(int arr_i = 0; arr_i < n; arr_i++){ arr[arr_i] = in.next(); } int result = gemstones(arr); System.out.println(result); }
} This is my java solution.
Seems like cookies are disabled on this browser, please enable them to open this website
Gemstones
You are viewing a single comment's thread. Return to all comments →
public class Solution {
} This is my java solution.