Skip to content

Instantly share code, notes, and snippets.

@jraczak
Created February 23, 2017 23:50
Show Gist options
  • Save jraczak/6859af0ccb9eb7dba5a1eafca67fd818 to your computer and use it in GitHub Desktop.
Save jraczak/6859af0ccb9eb7dba5a1eafca67fd818 to your computer and use it in GitHub Desktop.
int[] findTheNumbers(int[] a) {
int[] theNumbers = new int[2];
Arrays.sort(a);
int matchedNumbers = 0;
while (matchedNumbers < 2) {
for (int i=0; i < a.length; i++) {
if (a[i] != a[i+1]) {
theNumbers[matchedNumbers] = a[i];
matchedNumbers++;
}
}
}
return theNumbers;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment