Get Highest Answer Rate Question


  • 0

    Click here to see the full article post


  • 1
    I

    I doubt this answer might not be right..?

    Give the table like this:

    5 answer 285 123 1 1
    5 answer 285 123 1 2
    5 answer 369 123 2 3
    5 answer 369 123 2 4

    , which shows both of 285 and 369 have 2 answers

    With the answers, you will only get 285 as the answer.

    Moreover, for the answers: (num_answer / num_show) and COUNT(answer_id) / COUNT(IF(action = 'show', 1, 0)) will turn to be NULL when no 'show's at all... then how can you pick which one is the highest? Just by "Limit 1"?

    I think 'Limit 1' is a very 'dangerous' code phrase here.

    The problem here I think it should give some detailed explaination about how to solve ties and how to solve the situation when there is no 'show's?


    Some other cases:

    For this test case:

    5 show 285 null 1 1
    5 answer 285 123 1 2
    5 answer 369 123 2 3
    5 skip 369 null 2 4

    And for this one:

    5 answer 285 123 1 1
    5 answer 285 123 1 2
    5 answer 369 123 2 3
    5 skip 369 null 2 4

    If the answer for the last one is 285, then why for the 2nd one, it is also 285? May the actual "rules" can be more explict.


    No offense, I found there are lots of people 'disliked' this question... I think the examiners should do some modifications to change such condition.


  • 0
    N

    the result is random so can't be tested correctly


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.