Skip to content

Instantly share code, notes, and snippets.

@zeraf29
Created January 11, 2019 08:11
Show Gist options
  • Save zeraf29/69260e736577b198585ad0d8c732bc5b to your computer and use it in GitHub Desktop.
Save zeraf29/69260e736577b198585ad0d8c732bc5b to your computer and use it in GitHub Desktop.
get count number
import java.util.Arrays;
import java.util.List;
import java.util.Collections;
import java.utils.Arrays;
public class FindOdd {
public static int findIt(int[] a) {
int odd = 0;
List<Integer> list = Arrays.asList(ArrayUtils.toObject(a));
for(int i : a){
if(Collections.frequency(list, i)%2>0){
odd = i;
break;
}
}
return odd;
}
}
@zeraf29
Copy link
Author

zeraf29 commented Jan 11, 2019

Need fix upper source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment