Created
November 28, 2019 02:35
-
-
Save kwojcicki/7d7fa1a02d5d6fcf03ed015f58c78610 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
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