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.
select h.hacker_id , h.name from (
select h.hacker_id as id, count (case
when s.challenge_id=s.challenge_id and c.difficulty_level=d.difficulty_level and d.score=s.score then 1 else null end ) as countofchallenges
from hackers H inner join Submissions S on h.hacker_id=s.hacker_id inner join Challenges c on c.challenge_id=s.challenge_id inner join Difficulty D on c.difficulty_level=d.difficulty_level
group by h.hacker_id
having count (case
when s.challenge_id=s.challenge_id and c.difficulty_level=d.difficulty_level and d.score=s.score then 1 else null end ) >1 ) c inner join hackers H on h.hacker_id = c.id
order by countofchallenges 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
Top Competitors
You are viewing a single comment's thread. Return to all comments →
For SQL server / MS sql
select h.hacker_id , h.name from ( select h.hacker_id as id, count (case when s.challenge_id=s.challenge_id and c.difficulty_level=d.difficulty_level and d.score=s.score then 1 else null end ) as countofchallenges from hackers H inner join Submissions S on h.hacker_id=s.hacker_id inner join Challenges c on c.challenge_id=s.challenge_id inner join Difficulty D on c.difficulty_level=d.difficulty_level group by h.hacker_id having count (case when s.challenge_id=s.challenge_id and c.difficulty_level=d.difficulty_level and d.score=s.score then 1 else null end ) >1 ) c inner join hackers H on h.hacker_id = c.id order by countofchallenges desc , h.hacker_id