text: -- Use HAVING instead of WHERE since we have to filter on groups
  -- Split the total number of counts into 2 pieces
  -- First piece will be the largest number 
  -- Second piece will be the number which doesn't repeat (Unique) or is available once
  
  select H.hacker_id, H.name, count(C.challenge_id) as total_count
  from Hackers H join Challenges C
  on H.hacker_id = C.hacker_id
  group by H.hacker_id, H.name
  having total_count = 
  (
  select count(temp1.challenge_id) as max_count
      from challenges temp1
      group by temp1.hacker_id
      order by max_count desc
      limit 1
  )
  or total_count in
  (
      select distinct other_counts from (
  select H2.hacker_id, H2.name, count(C2.challenge_id) as other_counts
  from Hackers H2 join Challenges C2
  on H2.hacker_id = C2.hacker_id
  group by H2.hacker_id, H2.name
  ) temp2
      group by other_counts
  having count(other_counts) =1)
  order by total_count desc, H.hacker_id