1-liner with explanation


  • 1
    C

    It passed all the test case, but I am not sure if I understand the problem in the correct way. What I did is simply using the number of distinct records (requester_id,accepter_id) in request_accepted divided by the number of distinct records (sender_id,send_to_id) in friend_request

    select ifnull(round((select count(distinct requester_id,accepter_id) from request_accepted)/(select count(distinct sender_id, send_to_id) from friend_request),2),0) accept_rate
    

Log in to reply
 

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