Top Competitors

  • + 11 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