Election contract with percentages
So how do I exactly program this logic into a function? This is part of an election contract with only 5 candidates.
Write a function that returns the winner. In order to have a winner, two conditions should be satisfied as follows:
(i) The winner should have at least the 60% of votes, and
(ii) when (i) holds, the rest votes (<= 40%) should be given to at least 2 candidates.
Otherwise, there is no winner.
Any help is immensely appreciated!
submitted by /u/hassanrazza
[link] [comments]