Tell each player what percentile they're in
On the leaderboard we display «you're in the top X%» — that's the player's percentile rank relative to everyone else, a number from 0 to 1. For every player compute their percentile rank and round to four decimal places. With ties on score the ranks must be deterministic — so the score sort needs a second level by player id. Sort by score descending; ties broken by player id.
Expected output sample
This is what a correct answer looks like — its row count is its own, it doesn't have to match the schema tables.
| pr | score | player_id |
|---|---|---|
| 0.0000 | 95 | 1 |
| 0.1111 | 88 | 2 |
| 0.2222 | 88 | 3 |
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign in