Loading problem...
A city analytics platform records digital ballots where a voter may support multiple candidates.
Table: Votes
Weighted voting policy:
Task: Compute total weighted votes per candidate and return every candidate whose total is maximum.
Output requirements:
Supported submission environments:
Votes:
| voter | candidate |
|----------|------------|
| Kathy | null |
| Charles | Ryan |
| Charles | Christine |
| Charles | Kathy |
| Benjamin | Christine |
| Anthony | Ryan |
| Edward | Ryan |
| Terry | null |
| Evelyn | Kathy |
| Arthur | Christine |[
{"candidate":"Christine"},
{"candidate":"Ryan"}
]Charles splits one vote equally across three candidates (1/3 each). Kathy and Terry abstain (0 contribution). Christine and Ryan both finish with 2.333... weighted votes, so both are winners.
Votes:
| voter | candidate |
|-------|-----------|
| V1 | A |
| V1 | B |
| V2 | A |
| V3 | A |
| V3 | B |
| V3 | C |
| V4 | C |[
{"candidate":"A"}
]A receives 1/2 + 1 + 1/3 = 1.833..., B receives 1/2 + 1/3 = 0.833..., and C receives 1/3 + 1 = 1.333.... A is the unique winner.
Votes:
| voter | candidate |
|-------|-----------|
| U1 | Delta |
| U1 | Alpha |
| U2 | Alpha |
| U3 | Delta |
| U4 | null |[
{"candidate":"Alpha"},
{"candidate":"Delta"}
]Alpha gets 0.5 + 1 = 1.5 and Delta gets 0.5 + 1 = 1.5. The abstaining voter contributes nothing, so both tied winners are returned in ascending order.
Constraints