Available question text
Design an algorithm to elect a restaurant from a set of choices for a team outing. Each team member can select n options in their order of preference. The option wins as soon as more than 50% of first votes are there. When they are not, we remove the lowest voted option from everyone's ballot and repeat the process until we find a winner.
Example:
Restaurants:
A, B, C
Ballots:
Ballot 1: [A, B, C]
Ballot 2: [A, B, C]
Ballot 3: [B, C, A]
Ballot 4: [B, A, C]
Ballot 5: [C, A, B]
First Tally:
The first-rank choices on the 5 ballots are A, A, B, B, C
Candidate C has the lowest number of votes (just one vote from Ballot 5), thus it is removed.
Updated Ballots After Removing C:
Ballot 1: [A, B]
Ballot 2: [A, B]
Ballot 3: [B, A]
Ballot 4: [B, A]
Ballot 5: [A, B]
Second Tally:
The new first-rank choices on the 5 ballots become A, A, B, B, A
Candidate A wins because A now has 3 votes, which is more than 50% of the total.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
LinkedIn
Design an Algorithm to Elect a Restaurant for a Team Outing
Reported Feb 25, 2025 · 2 source reports
SENIOR
Source snapshot: Nov 12, 2026
View source