You are viewing a single comment's thread. Return to all comments →
General solution for any language. Without using any librery framework
static int gemstones(String[] arr) { int max=0; for(int i=0;i<arr[0].length();i++){ char ch=arr[0].charAt(i); boolean flag=false; if(i>0){ for(int m=i-1;m>=0;m--){ if(ch==arr[0].charAt(m)) { flag=true; break; } } } if(flag==false){ System.out.println(ch); int count=0; for(int j=1;j<arr.length;j++){ for(int k=0;k<arr[j].length();k++){ if(arr[0].charAt(i)==arr[j].charAt(k)){ count++; break; } } } if(count==arr.length-1){ //System.out.println(count); max++; } } } return max; }
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 →
General solution for any language. Without using any librery framework