Question: Python solution? Given the number of five-star and total reviews for each product a company sells, as well as the threshold percentage, what is the

Python solution? Given the number of five-star and total reviews for eachproduct a company sells, as well as the threshold percentage, what isPython solution?

Given the number of five-star and total reviews for each product a company sells, as well as the threshold percentage, what is the minimum number of additional five-star reviews the company needs to become five star seller. public static int fiveStarReviews (List productRatings, int ratings Threshold) { } Examples Example 1: Input: noOfProduct = 3 productRatings = [[4,4],[1,2],[3,6]] -> here, [1,2] indicates => [1 (five star reviews) ,2 (total reviews)]. threshold = 77 Output: 3 Explanation : We need to get the seller reach the threshold with minimum number of additional five star reviews. 65.66% Output: 3 Explanation : We need to get the seller reach the threshold with minimum number of additional five star reviews. Before we add more five star reviews, the percentage for this seller is ((4/4) + (1/2) + (3/6))/3 = 66.66% If we add a five star review to 2nd product, ((4/4) + (2/3) + (3/6))/3 = 72.22% If we add another five star review to 2nd product, ((4/4) + (3/4) + (376))/3 = 75% If we add a five star review to 3rd product, ((4/4) + (3/4) + (4/7))/3 - 77.38% At this point, 77% (threshold) is met. Therefore, answer is 3 (because that is the minimum five star reviews we need to add, to get the seller reach the threshold). Constraints: 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!