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.
SQL Solution, hope it helps. The main thing is using having
/* join tables together, to make a master table which contains all the info */
select sub.hacker_id, hak.name from submissions sub
join challenges cha on sub.challenge_id = cha.challenge_id
join hackers hak on sub.hacker_id = hak.hacker_id
join difficulty dif on cha.difficulty_level = dif.difficulty_level
/* filter logic, to eliminate submissions that did not earn full score */
where dif.score = sub.score
/* further eliminate hackers who only had one full-score submission */
group by sub.hacker_id, hak.name having count(sub.score) > 1
/* display by the order stated in the proble, */
order by count(sub.score) desc, sub.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 →
SQL Solution, hope it helps. The main thing is using having
/* join tables together, to make a master table which contains all the info */ select sub.hacker_id, hak.name from submissions sub join challenges cha on sub.challenge_id = cha.challenge_id join hackers hak on sub.hacker_id = hak.hacker_id join difficulty dif on cha.difficulty_level = dif.difficulty_level
/* filter logic, to eliminate submissions that did not earn full score */ where dif.score = sub.score
/* further eliminate hackers who only had one full-score submission */ group by sub.hacker_id, hak.name having count(sub.score) > 1
/* display by the order stated in the proble, */ order by count(sub.score) desc, sub.hacker_id