HTML & JS
#include <stdio.h>
/* leader problem in c */
int max_votes(int *a, int n) {
    int votes[101] = {0}, max = -1, max_index = -1;
    for(int i = 0; i < n; ++i)
        votes[a[i]]++;
    for(int i = 0; i < 101; ++i)
        if(max < votes[i]) {
            max = votes[i];
            max_index = i;
        }
    return max_index;
}

int main() {
	int n;
	scanf("%d", &n); // no. of voters
	int arr[n];
	for(int i = 0; i < n; ++i)
	    scanf("%d", &arr[i]);
	int leader = max_votes(arr, n);
	printf("%d\n", leader);
	return 0;
}

Generated URL:

Output:

3
Report Bug