Panda Guru LogoPanda
Guru

Atlassian | Voting application interview question

Round 1

Questions: Given a list of votes for the candidates
{c1, c2, c1, c2, c1, c2, c3, c4, c4}
we need to determine the winner based on the total number of votes for each candidate.

  1. In case of tie, what are all the different strategies we can follow?
  2. Which among the suggested strategy is the best? I googled and read that weighted strategy is a suitable one, but need help me with its implementation.

Candidate's Approach

The candidate provided a sample solution for the weighted strategy in Java. The solution involves creating a Candidate class to manage votes and their indices, allowing for comparison based on total votes and the order of votes in case of a tie. The main logic counts votes, sorts candidates, and determines the winner based on the defined criteria.

Interviewer's Feedback

No feedback provided.