Skip to content

Instantly share code, notes, and snippets.

@sgallese
Created April 11, 2018 15:13
Show Gist options
  • Save sgallese/5647c81f852fce34f2a93505dfd67749 to your computer and use it in GitHub Desktop.
Save sgallese/5647c81f852fce34f2a93505dfd67749 to your computer and use it in GitHub Desktop.
static String[] missingWords(String s, String t) {
String[] first = s.split(" ");
String[] second = t.split(" ");
int difference = first.length - second.length;
String [] missing = new String[difference];
int counter = 0;
for(int i=0;i< first.length;i++){
int flag=0;
for(int j=0;j<second.length;j++){
if(first[i].equals(second[j]))
flag=1;
}
if(flag==0){
missing[counter++]=first[i];
System.out.println(missing);
}
}
return missing;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment