int stringsCrossover(String[] inputArray, String result) {
int count = 0;
for (int i = 0; i < inputArray.length; i++) {
for (int j = i + 1; j < inputArray.length; j++) {
if (match(inputArray[i], inputArray[j], result)) {
count++;
}
}
}
return count;
}
boolean match(String a, String b, String result) {
for (int i = 0; i < a.length(); i++) {
if (a.charAt(i) != result.charAt(i) && b.charAt(i) != result.charAt(i)) {
return false;
}
}
return true;
}
Fede solution for crossover code fights problem
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.