Skip to content

Instantly share code, notes, and snippets.

@kwojcicki
Created December 1, 2019 22:58
Show Gist options
  • Save kwojcicki/300d01e6c06cd68b866475d5446e0444 to your computer and use it in GitHub Desktop.
Save kwojcicki/300d01e6c06cd68b866475d5446e0444 to your computer and use it in GitHub Desktop.
Pair findPairGivingSum(int[] numbers, int k){
for(int i = 0; i < numbers.length; i++){
for(int j = i + 1; j < numbers.length; j++){
if(numbers[i] + numbers[j] == k){
return new Pair(numbers[i], numbers[j]);
}
}
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment