Created
January 11, 2019 08:11
-
-
Save zeraf29/69260e736577b198585ad0d8c732bc5b to your computer and use it in GitHub Desktop.
get count number
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
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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Need fix upper source