At a company mixer, guest i has energy energy[i] and team team[i]. Every two guests from different teams shake hands once, making energy[i] * energy[j] buzz. Teammates skip it (they see each other every day).
Write mixer_buzz(energy: list[int], team: list[str]) -> int that returns the total buzz.
mixer_buzz([2, 3, 5], ["red", "blue", "red"])
# pairs from different teams: (0,1) -> 6, (1,2) -> 15; total 21
mixer_buzz([4, 1], ["ops", "ops"]) # 0, nobody shakes hands
0 <= len(energy) == len(team) <= 2 * 10^5; energies are in[-10^4, 10^4].- ⭐ Bonus: a speed test with 200,000 guests earns a star in one pass (O(n)).
Show hint
guest j adds energy[j] times the total energy of earlier guests on other teams. Keep a running total overall and one per team.