We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
WITH Max_Scores AS (
SELECT hacker_id, challenge_id, MAX(score) AS max_score
FROM Submissions
GROUP BY hacker_id, challenge_id
),
Total_Scores AS (
SELECT hacker_id, SUM(max_score) AS total_score
FROM Max_Scores
GROUP BY hacker_id
)
SELECT h.hacker_id, h.name, ts.total_score
FROM Total_Scores ts
JOIN Hackers h ON ts.hacker_id = h.hacker_id
WHERE ts.total_score > 0
ORDER BY ts.total_score DESC, h.hacker_id;
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Contest Leaderboard
You are viewing a single comment's thread. Return to all comments →
WITH Max_Scores AS ( SELECT hacker_id, challenge_id, MAX(score) AS max_score FROM Submissions GROUP BY hacker_id, challenge_id ), Total_Scores AS ( SELECT hacker_id, SUM(max_score) AS total_score FROM Max_Scores GROUP BY hacker_id ) SELECT h.hacker_id, h.name, ts.total_score FROM Total_Scores ts JOIN Hackers h ON ts.hacker_id = h.hacker_id WHERE ts.total_score > 0 ORDER BY ts.total_score DESC, h.hacker_id;