Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribedPython 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database And Transact SQL

Authors: Lucy Scott

1st Edition

1974679985, 978-1974679980

More Books

Students also viewed these Databases questions

Question

Is a court likely to enforce a click-on agreement?

Answered: 1 week ago