array
n/2
n
Note: You can assume input array to be non empty and that dominant element always exists.
Example:
Input : {2,3,2} Output : 2
public static int dominantNumber(int[] input) { }