Back to problems

Fair Electoral Vote Apportionment

Algorithm · Bloomberg · Medium

You are given 50 states, indexed from 0 to 49, with population[i] representing the population of the i-th state. You must distribute exactly E electoral votes among the states according to the Hamilton (largest remainder) method. The procedure works as follows: Assign one base vote to every state. Compute the total population P and the remaining votes R = E - 50. For each state, determine its exact quota: \[ \text{quota}[i] = \frac{\texttt{population}[i]}{P} \times R \] Give…

Checking your access…