Loading problem...
You are given two tables used by an election analytics service.
Candidate(id, name) stores the candidate registry. Vote(id, candidateId) stores one row per cast ballot.
Your task is to return the name of the single winning candidate. The winner is the candidate who received the highest total number of votes.
The dataset guarantees there is exactly one winner.
Output requirements:
Submissions are supported in:
Candidate:
| id | name |
|----|-------|
| 1 | Ava |
| 2 | Ben |
| 3 | Chloe |
Vote:
| id | candidateId |
|----|-------------|
| 1 | 2 |
| 2 | 2 |
| 3 | 1 |
| 4 | 3 |
| 5 | 2 |[{"name":"Ben"}]Ben receives three votes, which is more than every other candidate.
Candidate:
| id | name |
|----|---------|
| 10 | Iris |
| 11 | Jordan |
| 12 | Kai |
| 13 | Lennon |
Vote:
| id | candidateId |
|----|-------------|
| 1 | 13 |
| 2 | 11 |
| 3 | 13 |
| 4 | 10 |
| 5 | 13 |
| 6 | 11 |[{"name":"Lennon"}]Lennon wins with three votes, while Jordan has two and Iris has one.
Candidate:
| id | name |
|----|---------|
| 20 | North |
| 21 | South |
| 22 | East |
Vote:
| id | candidateId |
|----|-------------|
| 1 | 21 |[{"name":"South"}]With one ballot cast, South is the unique winner.
Constraints