2dbi

Efficient Teams

viaLeetCode

There are n candidates and n/2 teams to be formed. Each candidate has a skill level skill[i]. Form teams (pairs) so that every team has the same total skill; return the sum of team efficiencies, where a team''s efficiency is the product of its two members'' skills. If no valid pairing exists, return -1. Example: skill=[1,2,3,2] pairs as [1,3] and [2,2]; efficiencies 3 and 4; answer 7. (Sort, pair smallest with largest, all pair sums must equal.)

Add a follow-up question they asked
No follow-ups yet. Be the first to add one.
asked …
LeaderboardSalary
Language
Account