Wrong Test Case?


  • 0

    Is it a wrong test case?

    I've got a wrong answer as below:
    Input:

    {"headers":{"survey_log":["uid","action","question_id","answer_id","q_num","timestamp"]},"rows":{"survey_log":[[5,"show",285,null,1,1],[5,"show",285,null,1,2],[5,"answer",369,123,2,3],[5,"skip",369,null,2,4]]}}
    

    Output:
    {"headers": ["survey_log"], "values": [[369]]}
    Expected:
    {"headers": ["survey_log"], "values": [[285]]}

    However, according to the input data, the table is like this:

    uid action question_id answer_id q_num timestamp
    5 show 285 1 1
    5 show 285 1 2
    5 answer 369 123 2 3
    5 skip 369 2 4

    So, I think the correct answer should be '369' since its rate is 1/2 = 0.5. For questions '285', the rate is 0 since no one actually answered this question.

    So could any one can explain?


  • 0

    @Mr.Bin I see the problem is the definition of 'answer rate', but the expected answer is even not what is supposed according to the problem description.
    answer rate = count(answer) / count(show)


  • 0
    L

    I have the same error for this test case. I agree you that it is the question of definition of the answer rate. My understanding is count(answer)/(count(answer)+count(skip)). I think the description should be more clear.


  • 0

    Update: I saw the definition of answer rate. But it still cannot clear my concern on this case.

    #285 answer rate = 0/2
    #369 answer rate = 1/0

    Besides, it is very weird that problem 369 has no 'show' but a 'answer' record.


Log in to reply
 

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