about | help | code help+videos | done | prefs |
listWinRace
An array list contains the number of votes in each district for a given political candidate named Jones. There are only two candidates in the race and his opponent is named Sims. Positive numbers indicate that Jones won by that number of votes and negative numbers indicate that Sims won by that number of votes. The winner of the race is the candidate that has the most total votes from all the districts. Jones wins if there is a tie since he is the incumbent. Return true if Jones won and false if Sims won. listWinRace([20, -15]) → true listWinRace([20, 200, -300, 10, -10]) → false listWinRace([-25, 20, 3, 2]) → true ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 150 Post-solution available
Copyright Nick Parlante 2017 - privacy