1773. Percentage of Users Attended a Contest
My accepted SQL solution to LeetCode problem 1773, Percentage of Users Attended a Contest, running in 857ms.
- Difficulty: Easy
- SQL
- Runtime 857ms
- Memory 0.0B
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
SQL
Accepted on LeetCode — runtime 857ms, memory 0.0B, accepted 2025-12-31.
SELECT r.contest_id,
ROUND(COUNT(r.user_id) * 100.0 / (SELECT COUNT(*) FROM Users), 2) AS percentage
FROM Register r
GROUP BY r.contest_id
ORDER BY percentage DESC, r.contest_id ASC