1-liner with explanation

  • 4

    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

  • 0

    Many interviewers like in Facebook don't allow you using subquery, pls check out my no subquery solution:)

Log in to reply

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