7 2 2 1 2 3 2 2
2
static int majority(int[] a){int cand=0,c=0;for(int x:a){if(c==0){cand=x;c=1;}else if(x==cand) c++; else c--; }return cand;}
static int majority(int[] a){int cand=0,c=0;for(int x:a){if(c==0){cand=x;c=1;}else if(x==cand) c++; else c--; }return cand;}