פתרון שאלה 2
public static int maxIDX(int [] arr){
int maxIdx = 0;
for (int i=0;i<arr.length;i++){
if (arr[i]>arr[maxIdx])
maxIdx = i;
}
return maxIdx;
}
public static void theWinner(Vote [] arr){
int [] songs = new int[41];
for (int i=0;i<songs.length;i++)
songs[i] = 0;
for (Vote x : arr){
songs[x.getFirst()] +=7;
songs[x.getSecond()] +=5;
songs[x.getThird()] +=1;
}
System.out.println(maxIDX(songs));
}