Winners prediction
Anonymous User
154

In an onsite interview I was asked to write a function that accepts two parameters:
1- an array that represents count of votes for candidates like this: [2, 4, 5, 2, 1] where the first 2 is the number of votes the first candidate has gained so far, 4 is the count of votes the second candidate has gained so far and so on.
2- number of people who still did not vote and will be voting, for example 3 , so we have 3 votes still to be done that will affect the result.

The result of this function would be to predect who are the candidates who have a chance of winning, and the candidates who do not have a chance of winning, I was also asked to think of edge cases.

PS: this is not an AI and not a machine learning question,we do not have a set of huge data of behaviours. we have 2 inputs and required output

Can anyone solve that?

Comments (1)