Created
April 11, 2018 15:13
-
-
Save sgallese/5647c81f852fce34f2a93505dfd67749 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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