Skip to content

Instantly share code, notes, and snippets.

@kwojcicki
Created December 1, 2019 21:07
Show Gist options
  • Save kwojcicki/5cc86a8c3f2be60cfd9dce2f0688b632 to your computer and use it in GitHub Desktop.
Save kwojcicki/5cc86a8c3f2be60cfd9dce2f0688b632 to your computer and use it in GitHub Desktop.
int findUnique(int[] numbers){
for(int i = 0; i < numbers.length; i++){
boolean found = false;
for(int j = 0; j < numbers.length; j++){
if(j != i && numbers[i] == numbers[j]){
found = true;
break;
}
}
if(!found){
return numbers[i];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment