Algorithm · Roblox · Easy
You receive product records where each product is associated with a unit price and a quantity sold. Compute each product's total revenue, then return the N products with the largest totals. The approach should scale efficiently. Include test cases covering as many as 10,000 products. Example Explanation: The revenues are 720 for ItemA, 500 for ItemB, 840 for ItemC, 480 for ItemD, and 750 for ItemE. Therefore, the three highest-revenue products are ItemC, ItemE, and ItemA.
Checking your access…