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 maxscore as (
select s.hacker_id,
max(s.score) as max_score from submissions s
group by
s.hacker_id,s.challenge_id
),
totalscore as(
select m.hacker_id,
sum(m.max_score)as totalscore from maxscore m
group by
m.hacker_id
)
select h.hacker_id,h.name,ts.totalscore from hackers h
join totalscore ts
on h.hacker_id=ts.hacker_id
where ts.totalscore > 0
order by
ts.totalscore desc,
h.hacker_id asc;
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 maxscore as ( select s.hacker_id, max(s.score) as max_score from submissions s group by s.hacker_id,s.challenge_id ), totalscore as( select m.hacker_id, sum(m.max_score)as totalscore from maxscore m group by m.hacker_id ) select h.hacker_id,h.name,ts.totalscore from hackers h join totalscore ts on h.hacker_id=ts.hacker_id where ts.totalscore > 0 order by ts.totalscore desc, h.hacker_id asc;