FastPrepFair Electoral Vote Apportionment
Problems/Fair Electoral Vote Apportionment

Fair Electoral Vote Apportionment

Bloomberg LP logoBloomberg LP● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Bloomberg full-time phone screen. The report names the task of sharing out a fixed number of electoral votes in proportion to state populations. It does not give a complete, portable set of rules. So here we chose a fixed way to do it: use Hamilton largest-remainder apportionment with zero baseline seats, break equal remainders by smaller state index, and return seats in input order

Given nonnegative state populations and a nonnegative total number of votes, allocate every vote proportionally using the Hamilton largest-remainder method.

Function

allocateVotes(populations: int[], totalVotes: int) → int[]

Examples

Example 1

populations = [100,200,300]totalVotes = 10return = [2,3,5]

The largest remainder gives the final vote to state zero.

Example 2

populations = [1,1,1]totalVotes = 2return = [1,1,0]

Equal remainders are resolved by smaller index.

Constraints

  • 1 <= populations.length <= 10000
  • The population sum is positive.
  • Products fit in signed 64-bit integers.

More Bloomberg LP Phone Screen questions

  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
  • Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
  • Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Sparse Vector and Matrix OperationsPHONE SCREEN · Seen Oct 2026
  • Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Apartment Housemate PreferencesGoogle · PHONE SCREENGoogle interview questions
  • Minimum Fuel Car AlignmentFivetran · PHONE SCREENFivetran interview questions
  • Maximize Revenue from Decreasing InventoryChubb · OAChubb interview questions
  • Return Exact Cash Register ChangeBank of America · OA
  • Round Prices to Match TargetAirbnb · OAAirbnb interview questions
  • Delete and Freeze GameRubrik · OARubrik interview questions
  • Maximum Three-Server Difficulty ScoreVisa · OAVisa interview questions
  • Max Transfer RateAmazon · OA
  • Tennis Court SchedulingAtlassian · PHONE SCREEN · ONSITE INTERVIEWAtlassian interview questions
  • Adaptive Calibration ErrorOpenAI · PHONE SCREENOpenAI interview questions

Bloomberg LP interview experiences

  • Bloomberg SWE Phone Screen and Onsite: 1 Experience
  • Bloomberg SWE Phone Screens with Two Teams: 1 Experience
  • Bloomberg AI Interview, Hiring Level Not Reported: 2 Experiences
  • Bloomberg Experienced SWE AI Coding Interviews: 2 Experiences
  • Bloomberg New Grad AI-Assisted Coding Rounds: 3 Experiences
  • Bloomberg New Grad SWE AI-Assisted Coding Rounds: 1 Experience
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public int[] allocateVotes(int[] populations, int totalVotes) {
      // Write your code here.
    }

}
Checking account…