Question
Marketing wants each product's share of revenue as a whole-number percentage. Each row is "product,amount" with a POSITIVE integer amount; a product may appear on many rows, and there is at least one row. Return a dictionary mapping each product to floor(100 * product_total / grand_total). Shares may not add up to exactly 100 because of flooring — that is expected. Example: ["mug,30", "tee,50", "mug,20"] gives {"mug": 50, "tee": 50}.
revenue_share(rows: list[str]) → dict[str,int][["mug,30","tee,50","mug,20"]]out{"mug":50,"tee":50}State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.