Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Python/Divide_Players_Into_Teams_Of_Equal_Skills.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import List

class Solution:
def dividePlayers(self, skill: List[int]) -> int:
# Step 1: Sort the skill array
Expand All @@ -11,7 +13,8 @@ def dividePlayers(self, skill: List[int]) -> int:
# Check if the sum of current pair matches the required total_skill
if skill[i] + skill[-i - 1] != total_skill:
return -1 # Invalid configuration, return -1

# Calculate the chemistry (product of pair) and add it to the sum
chemistry_sum += skill[i] * skill[-i - 1]

return chemistry_sum # Return total chemistry
return chemistry_sum # Return total chemistry